-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I tried to simulate a game, 1. E4, 2. E5, but then it allows me to capture the E5 pawn with the E4 pawn even though I'm validating the moves.
public void attemptMove(IChessPlayer player, Move move) {
Side toMove = board.getSideToMove();
if((toMove.equals(Side.WHITE) && player.equals(playerBlack)) ||
(toMove.equals(Side.BLACK) && player.equals(playerWhite))) {
player.sendMessage("It's not your turn to move.");
return;
}
if(!board.isMoveLegal(move, true)) {
player.sendMessage("That's an illeagal move.");
return;
}
if(move.equals(new Move(Square.NONE, Square.NONE))) {
return;
}
boolean moved = board.doMove(move, true);
if(!moved) {
player.sendMessage("Something went wrong!");
return;
}
if(board.isDraw()) {
player.sendMessage("Draw!");
return;
}
if(board.isMated()) {
player.sendMessage("Checkmate!");
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels