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);
int score = -inf;
int nodeType = AllNode;
if (board.InCheck(board.sideToMove)) {
depth++;
} else {
//Null Move Pruning
if (!doingNullMove) {
if (ply && depth >= 3 && !board.InPossibleZug(board.sideToMove)) {
board.MakeMove(Move());
Board copy = board;
copy.MakeMove(Move());
doingNullMove = true;
ply++;
score = -PVS(board, depth - 3, -beta, -beta + 1).score;
int score = -PVS(copy, depth - 3, -beta, -beta + 1).score;
ply--;
doingNullMove = false;
board.MakeMove(Move());
if (searchStopped) return 0;
if (score >= beta) return beta;
if (score >= beta) return score;
}
}
}
int score = -inf;
int nodeType = AllNode;
nodes++;
GenerateMoves(board, board.sideToMove);