Merge pull request #12 from rektdie/RFP
implemented RFP with a margin of 100
This commit was merged in pull request #12.
This commit is contained in:
1 file changed
+23
-12
+23
-12
@@ -153,27 +153,38 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int staticEval = Evaluate(board);
|
||||||
|
|
||||||
if (depth <= 0) return Quiescence(board, alpha, beta);
|
if (depth <= 0) return Quiescence(board, alpha, beta);
|
||||||
|
|
||||||
if (board.InCheck(board.sideToMove)) {
|
if (board.InCheck(board.sideToMove)) {
|
||||||
depth++;
|
depth++;
|
||||||
} else {
|
} else {
|
||||||
//Null Move Pruning
|
if (ply) {
|
||||||
if (!doingNullMove) {
|
// Reverse Futility Pruning
|
||||||
if (ply && depth >= 3 && !board.InPossibleZug(board.sideToMove)) {
|
int margin = 100 * depth;
|
||||||
Board copy = board;
|
if (staticEval - margin >= beta && depth < 7) {
|
||||||
copy.MakeMove(Move());
|
return staticEval;
|
||||||
|
}
|
||||||
|
|
||||||
doingNullMove = true;
|
// Null Move Pruning
|
||||||
ply++;
|
if (!doingNullMove) {
|
||||||
int score = -PVS(copy, depth - 3, -beta, -beta + 1).score;
|
if (depth >= 3 && !board.InPossibleZug(board.sideToMove)) {
|
||||||
ply--;
|
Board copy = board;
|
||||||
doingNullMove = false;
|
copy.MakeMove(Move());
|
||||||
|
|
||||||
if (searchStopped) return 0;
|
doingNullMove = true;
|
||||||
if (score >= beta) return score;
|
ply++;
|
||||||
|
int score = -PVS(copy, depth - 3, -beta, -beta + 1).score;
|
||||||
|
ply--;
|
||||||
|
doingNullMove = false;
|
||||||
|
|
||||||
|
if (searchStopped) return 0;
|
||||||
|
if (score >= beta) return score;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int score = -inf;
|
int score = -inf;
|
||||||
|
|||||||
Reference in new issue
Block a user