Closed Smartie1242 closed 3 years ago
There's an error in your FEN string that's why you got the exception. Since the KQkq
castle rights are fully flagged the lib trust the black king is still on e8 while this is obviously not true. The correct FEN string should reflect the lost castle rights by black pieces, e.g.: r2k3r/p1q1b1p1/4b2p/nB1pp3/8/P2PB3/1PP2PPP/R3K2R b KQ - 0 2
After fixing this the issue should go away.
Given the board configuration "r2k3r/p1q1b1p1/4b2p/nB1pp3/8/P2PB3/1PP2PPP/R3K2R b KQkq - 0 2". The following error is given:
com.github.bhlangonijr.chesslib.move.MoveGeneratorException: Couldn't generate Legal moves: at com.github.bhlangonijr.chesslib.move.MoveGenerator.generateLegalMoves (MoveGenerator.java:352) at com.github.bhlangonijr.chesslib.Board.legalMoves (Board.java:1399) at nl.ndl.automatedchessboard.Main.lambda$main$0 (Main.java:27) at java.lang.Thread.run (Thread.java:833) Caused by: java.lang.NullPointerException: Cannot invoke "com.github.bhlangonijr.chesslib.PieceType.equals(Object)" because "fromType" is null at com.github.bhlangonijr.chesslib.Board.isMoveLegal (Board.java:1122) at com.github.bhlangonijr.chesslib.move.MoveGenerator.lambda$generateLegalMoves$0 (MoveGenerator.java:349) at java.util.Collection.removeIf (Collection.java:576) at com.github.bhlangonijr.chesslib.move.MoveGenerator.generateLegalMoves (MoveGenerator.java:349) at com.github.bhlangonijr.chesslib.Board.legalMoves (Board.java:1399) at nl.ndl.automatedchessboard.Main.lambda$main$0 (Main.java:27) at java.lang.Thread.run (Thread.java:833)
There are still moves remaining obviously therefore there is likely a bug within the code.