Fix attack occupancy in IsLegal and restore perft parity

This commit is contained in:
rektdie committed 2026-02-18 11:59:48 +01:00
1 parent a9f466b37b
commit d6c10b8da6
2 files changed
+11 -13

No files matched your search

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