Fix blocking checkmate

main
Elnu 2 years ago
parent e178d88742
commit 5e1553aaf6

@ -227,13 +227,10 @@ public class Board {
if (inCheck) { if (inCheck) {
isGameOver = true; isGameOver = true;
for (Move move : getAllLegalMoves(!movedPiece.black)) { for (Move move : getAllLegalMoves(!movedPiece.black)) {
move(move);
if (!oppositeKing.isInCheck(move, this)) { if (!oppositeKing.isInCheck(move, this)) {
isGameOver = false; isGameOver = false;
undoMove();
break; break;
} }
undoMove();
} }
} else if (getAllLegalMoves(movedPiece.black).isEmpty()) { } else if (getAllLegalMoves(movedPiece.black).isEmpty()) {
isGameOver = true; isGameOver = true;