Bug 527 - 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.
Summary: It is found that, if the player move a piece which lead to the king of Red pi...
Status: CONFIRMED
Alias: None
Product: CS3343 2020 Group 9_Chinese Chess
Classification: Unclassified
Component: ChessGame (show other bugs)
Version: V2.0
Hardware: PC Windows
: --- normal
Deadline: 2020-10-03
Assignee: FENG Yi
URL:
Depends on:
Blocks:
 
Reported: 2020-12-06 23:25 HKT by guohan2-c
Modified: 2020-12-06 23:43 HKT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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]