From c0d196a9f5fd6d5f17844dccc8f43213adc3c8c9 Mon Sep 17 00:00:00 2001 From: rektdie Date: Sat, 29 Mar 2025 15:56:40 +0100 Subject: [PATCH] increased depth immidiately previously on check | bench 3103117 --- source/search.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index ff1f712..1aedc12 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -207,9 +207,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) { const int staticEval = HCE::Evaluate(board); - if (board.InCheck()) { - depth++; - } else { + if (!board.InCheck()) { if (ply) { // Reverse Futility Pruning int margin = 100 * depth; @@ -267,26 +265,28 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) { int reductions = GetReductions(board, currMove, depth, moveSeen, ply); + int newDepth = depth + board.InCheck() - 1; + // First move (suspected PV node) if (!i) { // Full search - score = -PVS(copy, depth - 1, -beta, -alpha, ply + 1).score; + score = -PVS(copy, newDepth, -beta, -alpha, ply + 1).score; } else if (reductions) { // Null-window search with reductions - score = -PVS(copy, depth - 1 - reductions, -alpha-1, -alpha, ply + 1).score; + score = -PVS(copy, newDepth - reductions, -alpha-1, -alpha, ply + 1).score; if (score > alpha) { // Null-window search now without the reduction - score = -PVS(copy, depth - 1, -alpha-1, -alpha, ply + 1).score; + score = -PVS(copy, newDepth, -alpha-1, -alpha, ply + 1).score; } } else { // Null-window search - score = -PVS(copy, depth - 1, -alpha-1, -alpha, ply + 1).score; + score = -PVS(copy, newDepth, -alpha-1, -alpha, ply + 1).score; } // Check if we need to do full window re-search if (i && score > alpha && score < beta) { - score = -PVS(copy, depth - 1, -beta, -alpha, ply + 1).score; + score = -PVS(copy, newDepth, -beta, -alpha, ply + 1).score; } if (searchStopped) return 0; -- 2.47.3