From aff1f67997cd2584ea7c82d967ac7bfd4cc77861 Mon Sep 17 00:00:00 2001 From: Nonlinear2 <131959792+Nonlinear2@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:17:24 +0200 Subject: [PATCH] simplify see pruning in qsearch passed non-regression STC: LLR: 2.96 (-2.94,2.94) <-1.75,0.25> Total: 34880 W: 9193 L: 8968 D: 16719 Ptnml(0-2): 103, 4047, 8935, 4232, 123 https://tests.stockfishchess.org/tests/view/66ee83bd86d5ee47d953b15b passed non-regression LTC: LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 69126 W: 17529 L: 17357 D: 34240 Ptnml(0-2): 41, 7507, 19285, 7699, 31 https://tests.stockfishchess.org/tests/view/66ef3e0386d5ee47d953b1d3 closes https://github.com/official-stockfish/Stockfish/pull/5607 Bench: 1339840 --- src/search.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 229aef9b218..d87a6b9a041 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1596,19 +1596,11 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta) continue; } - // If static eval is much lower than alpha and move is - // not winning material, we can prune this move. (~2 Elo) - if (futilityBase <= alpha && !pos.see_ge(move, 1)) + // if static exchange evaluation is low enough + // we can prune this move. (~2 Elo) + if (!pos.see_ge(move, alpha - futilityBase)) { - bestValue = std::max(bestValue, futilityBase); - continue; - } - - // If static exchange evaluation is much worse than what - // is needed to not fall below alpha, we can prune this move. - if (futilityBase > alpha && !pos.see_ge(move, (alpha - futilityBase) * 4)) - { - bestValue = alpha; + bestValue = (futilityBase > alpha) ? alpha : std::max(bestValue, futilityBase); continue; } }