doing copy make in NMP

This commit is contained in:
rektdie committed 2025-03-06 05:43:30 +01:00
1 parent 58da8b52fa
commit 1f868f07d2
1 file changed
+7 -8
+7 -8
View File
@@ -155,31 +155,30 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
if (depth <= 0) return Quiescence(board, alpha, beta); if (depth <= 0) return Quiescence(board, alpha, beta);
int score = -inf;
int nodeType = AllNode;
if (board.InCheck(board.sideToMove)) { if (board.InCheck(board.sideToMove)) {
depth++; depth++;
} else { } else {
//Null Move Pruning //Null Move Pruning
if (!doingNullMove) { if (!doingNullMove) {
if (ply && depth >= 3 && !board.InPossibleZug(board.sideToMove)) { if (ply && depth >= 3 && !board.InPossibleZug(board.sideToMove)) {
board.MakeMove(Move()); Board copy = board;
copy.MakeMove(Move());
doingNullMove = true; doingNullMove = true;
ply++; ply++;
score = -PVS(board, depth - 3, -beta, -beta + 1).score; int score = -PVS(copy, depth - 3, -beta, -beta + 1).score;
ply--; ply--;
doingNullMove = false; doingNullMove = false;
board.MakeMove(Move());
if (searchStopped) return 0; if (searchStopped) return 0;
if (score >= beta) return beta; if (score >= beta) return score;
} }
} }
} }
int score = -inf;
int nodeType = AllNode;
nodes++; nodes++;
GenerateMoves(board, board.sideToMove); GenerateMoves(board, board.sideToMove);