bugfix: perft

This commit is contained in:
rektdie committed 2025-03-20 20:23:22 +01:00
1 parent 20ab2f476a
commit 8d5024a4a4
2 files changed
+4 -2

No files matched your search

+4 -1
View File
@@ -1,7 +1,8 @@
#include "perft.h"
#include "stopwatch.h"
#include "movegen.h"
U64 HelperPerft(Board board, int depth) {
static U64 HelperPerft(Board board, int depth) {
MOVEGEN::GenerateMoves(board);
if (depth == 1) return board.currentMoveIndex;
@@ -13,6 +14,7 @@ U64 HelperPerft(Board board, int depth) {
Board copy = board;
board.MakeMove(board.moveList[i]);
nodes += HelperPerft(board, depth - 1);
positionIndex--;
board = copy;
}
return nodes;
@@ -28,6 +30,7 @@ void Perft(Board &board, int depth) {
Board copy = board;
board.MakeMove(board.moveList[i]);
U64 nodeCount = HelperPerft(board, depth - 1);
positionIndex--;
board = copy;
totalNodes += nodeCount;
board.moveList[i].PrintMove();