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
This commit is contained in:
Jakub Ciolek
2026-01-06 12:08:08 +01:00
committed by Joost VandeVondele
parent 8be6b14218
commit c27c1747e3
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -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;
}
}