]> git.sesse.net Git - stockfish/commitdiff
Do shallower search in case of lmr being not successful enough
authorMichael Chaly <Vizvezdenec@gmail.com>
Thu, 17 Nov 2022 15:31:59 +0000 (18:31 +0300)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 19 Nov 2022 08:23:26 +0000 (09:23 +0100)
In case of a move passing LMR but it results being not too far from
the current best search result produce a full depth search with reduced depth.

Original idea by lonfom169 .

Passed STC:
https://tests.stockfishchess.org/tests/view/6373409b54d69a2f33913fbd
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 169504 W: 45351 L: 44848 D: 79305
Ptnml(0-2): 598, 18853, 45353, 19344, 604

Passed LTC:
https://tests.stockfishchess.org/tests/view/6374c58528e3405283eb8d2d
LLR: 2.96 (-2.94,2.94) <0.50,2.50>
Total: 51144 W: 13802 L: 13471 D: 23871
Ptnml(0-2): 19, 4928, 15362, 5229, 34

closes https://github.com/official-stockfish/Stockfish/pull/4230

bench 4277005

src/search.cpp

index 77619345c8f397cc9f7d577a20063f460c6973d5..5839763dc7fd647fa8e91d92cb874e54368c1126 100644 (file)
@@ -1184,8 +1184,11 @@ moves_loop: // When in check, search starts here
           // Do full depth search when reduced LMR search fails high
           if (value > alpha && d < newDepth)
           {
+              // Adjust full depth search based on LMR results - if result
+              // was good enough search deeper, if it was bad enough search shallower
               const bool doDeeperSearch = value > (alpha + 64 + 11 * (newDepth - d));
-              value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch, !cutNode);
+              const bool doShallowerSearch = value < bestValue + newDepth;
+              value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch - doShallowerSearch, !cutNode);
 
               int bonus = value > alpha ?  stat_bonus(newDepth)
                                         : -stat_bonus(newDepth);