bugfix: perft
This commit is contained in:
1 parent
20ab2f476a
commit
8d5024a4a4
2 files changed
+4
-2
No files matched your search
+4
-1
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user