From c27c1747e3956bc3048ceb1ced00802bda0ec86d Mon Sep 17 00:00:00 2001 From: Jakub Ciolek Date: Sat, 3 Jan 2026 23:46:46 +0100 Subject: [PATCH] qsearch: prevent bestValue from going down The bestValue can sometimes go down. This happens 2% of the time or so. This fix stops it from decreasing. Failed gainer STC: LLR: -2.94 (-2.94,2.94) <0.00,2.00> Total: 146176 W: 37930 L: 37976 D: 70270 Ptnml(0-2): 480, 17422, 37366, 17304, 516 https://tests.stockfishchess.org/tests/view/6953be19572093c1986da66a Passed Non-regression LTC: LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 257796 W: 65662 L: 65683 D: 126451 Ptnml(0-2): 164, 28247, 72087, 28246, 154 https://tests.stockfishchess.org/tests/view/69554ff0d844c1ce7cc7e333 closes https://github.com/official-stockfish/Stockfish/pull/6520 fixes https://github.com/official-stockfish/Stockfish/issues/6519 Bench: 2477446 --- AUTHORS | 1 + src/search.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index fac1e7d8d..1c3f4b97f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -111,6 +111,7 @@ Hongzhi Cheng Ivan Ivec (IIvec) Jacques B. (Timshel) Jake Senne (w1wwwwww) +Jakub Ciolek (jake-ciolek) Jan Ondruš (hxim) Jared Kish (Kurtbusch, kurt22i) Jarrod Torriero (DU-jdto) diff --git a/src/search.cpp b/src/search.cpp index afdda262c..42294ed01 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1653,7 +1653,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta) // we can prune this move. if (!pos.see_ge(move, alpha - futilityBase)) { - bestValue = std::min(alpha, futilityBase); + bestValue = std::max(bestValue, std::min(alpha, futilityBase)); continue; } }