Closed Jochengehtab closed 11 months ago
This is not an issue. Board#isMoveLegal()
essentially verifies whether the move leaves the board in a valid state (It's arguable if the function naming is misleading though). This is useful when you want to use this function to validate the board state when editing the board - UI drag & drop feature - and want to make sure the final board state is in a valid state (i.e. king doesn't remain in check while moving other pieces).
If you want to make sure user's input is a legal move you should match it against Board#legalMoves()
.
Why does
board.isMoveLegal(new Move(Square.D2, Square.D5), true);
does return true in the starting position ??????????????????????????????????????????