Closed dlbbld closed 3 years ago
Is there any check on this? When I supply an incorrect FEN, I prefer the system to complain, instead of doing something unexpected.
For example, when I mistype the side field, the system assumes that Black has the move. It would be much better to throw an exception, informing that the FEN is wrong. For example:
final Board board = new Board();
// invalid side field
board.loadFromFen("r1bqk1nr/pppp1ppp/2n5/2b1p3/2B1P3/5N2/PPPP1PPP/RNBQK2R x KQkq - 0 4");
// board assumes black has the move
System.out.println(board.getSideToMove()); // BLACK
I am looking into this one. Will fix in the next release.
Closing the issue as it became stale.
I suggest to add more tests when reading the FEN. At the very least you should not allow a position where the opponent king of the player having the move is in check! I think as such you could improve the API further. Please see examples below, I hope you get the idea: