doing copy make in NMP #9
+7
-8
@@ -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);
|
||||||
|
|||||||
Reference in new issue
Block a user