bhlangonijr / chesslib

chess library for legal move generation, FEN/PGN parsing and more
Apache License 2.0
229 stars 80 forks source link

getEnPassantTarget and isEnPassantMove do not work as expected #98

Closed dlbbld closed 2 years ago

dlbbld commented 2 years ago

The getEnPassantTarget on the Board and MoveBackup class does not work as expected, as well isEnPassantMove on class MoveBackup.

final Board board = new Board();
board.doMove("e4");
board.doMove("Nf6");
board.doMove("e5");
board.doMove("d5");
assertEquals(Square.D6, board.getEnPassantTarget()); // fails, is D5
assertEquals(Square.D6, board.getBackup().getLast().getEnPassantTarget()); // fails, is NONE
board.doMove("exd6");
assertTrue(board.getBackup().getLast().isEnPassantMove()); // fails, is false