introduced basic InCheck and IsLegal

This commit is contained in:
rektdie committed 2025-03-24 16:45:27 +01:00
1 parent d0ba47c956
commit 2943fccce6
4 files changed
+25 -9

No files matched your search

+2 -1
View File
@@ -5,12 +5,12 @@
static U64 HelperPerft(Board board, int depth) {
MOVEGEN::GenerateMoves<All>(board);
if (depth == 1) return board.currentMoveIndex;
if (depth == 0) return 1ULL;
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]);
nodes += HelperPerft(copy, depth - 1);
@@ -26,6 +26,7 @@ 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]);
U64 nodeCount = HelperPerft(copy, depth - 1);