From 2678606e8dbeac8332909f0b3e43638936570835 Mon Sep 17 00:00:00 2001 From: xoto10 <23479932+xoto10@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:27:09 +0100 Subject: [PATCH] Consider wider range of moves near leaves. try to avoid missing good moves for opponent or engine, by updating bestMove also when value == bestValue (i.e. value == alpha) under certain conditions. In particular require this is at higher depth in the tree, leaving the logic near the root unchanged, and only apply randomly. Avoid doing this near mate scores, leaving mate PVs intact. Passed SMP STC 6+0.06 th7 : LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 42040 W: 10930 L: 10624 D: 20486 Ptnml(0-2): 28, 4682, 11289, 4998, 23 https://tests.stockfishchess.org/tests/view/66608b00c340c8eed7757d1d Passed SMP LTC 24+0.24 th7 : LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 73692 W: 18978 L: 18600 D: 36114 Ptnml(0-2): 9, 7421, 21614, 7787, 15 https://tests.stockfishchess.org/tests/view/666095e8c340c8eed7757d49 closes https://github.com/official-stockfish/Stockfish/pull/5367 Bench 1205168 --- src/search.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 8fb65fe7..75eea2fd 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1283,11 +1283,17 @@ moves_loop: // When in check, search starts here rm.score = -VALUE_INFINITE; } - if (value > bestValue) + // In case we have an alternative move equal in eval to the current bestmove, + // promote it to bestmove by pretending it just exceeds alpha (but not beta). + int inc = (value == bestValue && (int(nodes) & 15) == 0 + && ss->ply + 2 + ss->ply / 32 >= thisThread->rootDepth + && std::abs(value) + 1 < VALUE_TB_WIN_IN_MAX_PLY); + + if (value + inc > bestValue) { bestValue = value; - if (value > alpha) + if (value + inc > alpha) { bestMove = move;