fixed checkmate and stalemate detection

This commit is contained in:
rektdie committed 2025-03-24 20:01:32 +01:00
1 parent 3090dbac8b
commit d4c7263b93
5 files changed
+24 -27

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ static U64 HelperPerft(Board board, int depth) {
for (int i = 0; i < board.currentMoveIndex; i++) {
if (!board.IsLegal(board.moveList[i])) continue;
Board copy = board;
copy.MakeMove(board.moveList[i]);
copy.MakeMove(board.moveList[i], false);
nodes += HelperPerft(copy, depth - 1);
positionIndex--;
}
@@ -28,7 +28,7 @@ void Perft(Board &board, int depth) {
for (int i = 0; i < board.currentMoveIndex; i++) {
if (!board.IsLegal(board.moveList[i])) continue;
Board copy = board;
copy.MakeMove(board.moveList[i]);
copy.MakeMove(board.moveList[i], false);
U64 nodeCount = HelperPerft(copy, depth - 1);
positionIndex--;
totalNodes += nodeCount;