doing copy make in NMP #9

Merged
rektdie merged 3 commits from NMP into legalMovegen 2025-03-06 07:09:20 +01:00
Showing only changes of commit 1f868f07d2 - Show all commits
+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);