Steps to reproduce: 1. Move the red minister from (2, 0) to (0, 2) 2. Move the black horse from (0, 9) to (0, 8) 3. Move the red minister from (0, 2) to (2, 4) 4. Move the black horse from (0, 8) to (0, 7) 5. Move the red minister from (2, 4) to (4, 6) Actual result: The move is successfully performed without error alert. Expected result: The movement should be checked as invalid. The program prompt "The move you want to make is invalid!"
The problem is located in the isValidMove() under the Rule class. The move which tries to let the minister chess pieces across the river is checked as an invalid one. Solved.
(In reply to guohan2-c from comment #1) > The problem is located in the isValidMove() under the Rule class. The move > which tries to let the minister chess pieces across the river is checked as > an invalid one. Solved. The part of code modified can be referred to line 82-93 if(chess instanceof Minister){ int middle_x = (from_x + this.to_x) / 2; int middle_y = (from_y + this.to_y) / 2; if(chess.getType().equals("red")) { if(this.to_y >= 5) return false; } else { if(this.to_y < 5) return false; } if(board[middle_x][middle_y] != null) return false; return true; }