resetting board correctly on non legal makemove | bench 1857933
This commit is contained in:
1 parent
43c7e0caaf
commit
44af851081
1 file changed
+5
-1
+5
-1
@@ -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++;
|
||||
|
||||
Reference in new issue
Block a user