Bug 527

Summary: It is found that, if the player move a piece which lead to the king of Red pieces and the king of Black pieces on the same column, with no other pieces in between them, the movement is valid. However, this move should not be allowed.
Product: CS3343 2020 Group 9_Chinese Chess Reporter: guohan2-c
Component: ChessGameAssignee: FENG Yi <yfeng28-c>
Status: CONFIRMED ---    
Severity: normal CC: guohan2-c, longtduan2-c, yfeng28-c, yinuowang3-c, yujiawang7-c
Priority: ---    
Version: V2.0   
Hardware: PC   
OS: Windows   
Deadline: 2020-10-03   

Description guohan2-c 2020-12-06 23:25:02 HKT
Steps to Reproduce:
1. Run the program
2. Input "new game"
3. Input "4 3 4 4"
4. Input "4 6 4 5"
5. Input "4 4 4 5"
6. Input "4 9 4 8"
7. Input "4 5 4 6"
8. Input "0 9 0 8"
8. Input "4 6 4 7"
8. Input "4 8 4 7"

Actual Result:
The move "4 8 4 7" is done.

Expected Result:
The movement is invalid.
Comment 1 guohan2-c 2020-12-06 23:34:38 HKT
The problem is located in the isValidMove() function under the Rule class. The checking for the situation where the red king and black king are in the same column, one king can kill the other king at its turn is set as a valid move.
Comment 2 guohan2-c 2020-12-06 23:43:32 HKT
The problem is located in the isValidMove() function under the Rule class. The checking for the situation where the red king and black king are in the same column, is set as an invalid move.
The added code part can be referred to [line 58-81, Rule class]