Added perft function + fixed some move generation bugs(there are still some)

This commit is contained in:
rektdie committed 2024-04-01 22:04:43 +02:00
1 parent 915b93ad5a
commit 5962c37546
6 files changed
+98 -43

No files matched your search

+3 -3
View File
@@ -394,6 +394,9 @@ void Board::UnmakeMove() {
int direction = lastMove.capturedColor ? south : north;
// Removing attacker piece from new square
RemovePiece(lastMove.attackerPiece, lastMove.moveTo, !lastMove.capturedColor);
// Setting back the attacker
SetPiece(lastMove.attackerPiece, lastMove.moveFrom, !lastMove.capturedColor);
@@ -431,9 +434,6 @@ void Board::UnmakeMove() {
SetPiece(lastMove.capturedPiece, lastMove.moveTo, lastMove.capturedColor);
}
// Removing attacker piece from new square
RemovePiece(lastMove.attackerPiece, lastMove.moveTo, !lastMove.capturedColor);
castlingRights = lastMove.castlingRights;
if (halfMoves & 2 == 0) fullMoves--;
halfMoves--;