From f00d91f8ac72de8d201f8b50968bb66b1235dc9a Mon Sep 17 00:00:00 2001 From: Daniel Monroe Date: Sun, 12 Jan 2025 13:59:38 -0800 Subject: [PATCH] Refine probcut Allow probcut for depth 3 and disable deeper verification search when it would simply repeat the qsearch. Passed STC LLR: 2.93 (-2.94,2.94) <0.00,2.00> Total: 283232 W: 74450 L: 73760 D: 135022 Ptnml(0-2): 1052, 33780, 71349, 34296, 1139 https://tests.stockfishchess.org/tests/view/67843b58460e2910c51ddcc6 Passed LTC LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 339654 W: 86845 L: 85893 D: 166916 Ptnml(0-2): 298, 37734, 92802, 38704, 289 https://tests.stockfishchess.org/tests/view/678aa722c00c743bc9e9face closes https://github.com/official-stockfish/Stockfish/pull/5797 bench 1288648 --- src/search.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 1d2604c2..d5e86ca9 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -860,7 +860,7 @@ Value Search::Worker::search( // If we have a good enough capture (or queen promotion) and a reduced search // returns a value much above beta, we can (almost) safely prune the previous move. probCutBeta = beta + 174 - 56 * improving; - if (depth > 3 + if (depth >= 3 && !is_decisive(beta) // If value from transposition table is lower than probCutBeta, don't attempt // probCut there and in further interactions with transposition table cutoff @@ -871,6 +871,7 @@ Value Search::Worker::search( assert(probCutBeta < VALUE_INFINITE && probCutBeta > beta); MovePicker mp(pos, ttData.move, probCutBeta - ss->staticEval, &thisThread->captureHistory); + Depth probCutDepth = std::max(depth - 4, 0); while ((move = mp.next_move()) != Move::none()) { @@ -899,9 +900,9 @@ Value Search::Worker::search( value = -qsearch(pos, ss + 1, -probCutBeta, -probCutBeta + 1); // If the qsearch held, perform the regular search - if (value >= probCutBeta) - value = - -search(pos, ss + 1, -probCutBeta, -probCutBeta + 1, depth - 4, !cutNode); + if (value >= probCutBeta && probCutDepth > 0) + value = -search(pos, ss + 1, -probCutBeta, -probCutBeta + 1, probCutDepth, + !cutNode); pos.undo_move(move); @@ -909,7 +910,7 @@ Value Search::Worker::search( { // Save ProbCut data into transposition table ttWriter.write(posKey, value_to_tt(value, ss->ply), ss->ttPv, BOUND_LOWER, - depth - 3, move, unadjustedStaticEval, tt.generation()); + probCutDepth + 1, move, unadjustedStaticEval, tt.generation()); if (!is_decisive(value)) return value - (probCutBeta - beta);