From 6b9eb61a2f06f13c2646ad1169fb99e83979984a Mon Sep 17 00:00:00 2001 From: rektdie Date: Thu, 6 Mar 2025 22:28:24 +0100 Subject: [PATCH] implemented RFP with a margin of 100 --- source/search.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index c9a96a2..68be313 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -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 (board.InCheck(board.sideToMove)) { depth++; } else { - //Null Move Pruning - if (!doingNullMove) { - if (ply && depth >= 3 && !board.InPossibleZug(board.sideToMove)) { - Board copy = board; - copy.MakeMove(Move()); + if (ply) { + // Reverse Futility Pruning + int margin = 100 * depth; + if (staticEval - margin >= beta && depth < 7) { + return staticEval; + } - doingNullMove = true; - ply++; - int score = -PVS(copy, depth - 3, -beta, -beta + 1).score; - ply--; - doingNullMove = false; - - if (searchStopped) return 0; - if (score >= beta) return score; + // Null Move Pruning + if (!doingNullMove) { + if (depth >= 3 && !board.InPossibleZug(board.sideToMove)) { + Board copy = board; + copy.MakeMove(Move()); + + doingNullMove = true; + 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; -- 2.47.3