resetting board correctly on non legal makemove | bench 1857933

This commit is contained in:
rektdie committed 2025-04-01 03:36:07 +02:00
1 parent 43c7e0caaf
commit 44af851081
1 file changed
+5 -1
+5 -1
View File
@@ -222,6 +222,7 @@ void Board::Promote(int square, int pieceType, int color, bool isCapture) {
}
bool Board::MakeMove(Move move) {
Board save = *this;
// Null Move
if (!move) {
int newEpTarget = noEPTarget;
@@ -347,7 +348,10 @@ bool Board::MakeMove(Move move) {
MOVEGEN::GenThreatMaps(*this);
sideToMove = !sideToMove;
if (InCheck()) return false;
if (InCheck()) {
*this = save;
return false;
}
sideToMove = !sideToMove;
if (attackerColor == Black) fullMoves++;