| Summary: | Minister can move across the river to the opponent's side, but it is not supposed to by rules. | ||
|---|---|---|---|
| Product: | CS3343 2020 Group 9_Chinese Chess | Reporter: | guohan2-c |
| Component: | ChessGame | Assignee: | FENG Yi <yfeng28-c> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | guohan2-c, kaipewang2-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-11-15 16:18:28 HKT
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; } |