was making every move twice | bench 888803

This commit is contained in:
rektdie committed 2025-03-25 11:52:36 +01:00
1 parent 030c421364
commit 12c600e1c4
5 files changed
+24 -28

No files matched your search

+4 -4
View File
@@ -10,9 +10,9 @@ static U64 HelperPerft(Board board, int depth) {
U64 nodes = 0;
for (int i = 0; i < board.currentMoveIndex; i++) {
if (!board.IsLegal(board.moveList[i])) continue;
Board copy = board;
copy.MakeMove(board.moveList[i], false);
bool isLegal = copy.MakeMove(board.moveList[i]);
if (!isLegal) continue;
nodes += HelperPerft(copy, depth - 1);
positionIndex--;
}
@@ -26,9 +26,9 @@ void Perft(Board &board, int depth) {
Stopwatch sw;
for (int i = 0; i < board.currentMoveIndex; i++) {
if (!board.IsLegal(board.moveList[i])) continue;
Board copy = board;
copy.MakeMove(board.moveList[i], false);
bool isLegal = copy.MakeMove(board.moveList[i]);
if (!isLegal) continue;
U64 nodeCount = HelperPerft(copy, depth - 1);
positionIndex--;
totalNodes += nodeCount;