]> git.sesse.net Git - stockfish/commitdiff
50-moves rule improvement for transposition table
authorjoergoster <osterj165@googlemail.com>
Thu, 12 Dec 2019 11:53:47 +0000 (12:53 +0100)
committerStéphane Nicolet <cassio@free.fr>
Thu, 9 Jan 2020 18:48:47 +0000 (19:48 +0100)
User "adentong" reported recently of a game where Stockfish blundered a game
in a tournament because during a search there was an hash-table issue for
positions inside the tree very close to the 50-moves draw rule. This is part
of a problem which is commonly referred to as the Graph History Interaction (GHI),
and is difficult to solve in computer chess because storing the 50-moves counter
in the hash-table loses Elo in general.

Links:
Issue 2451    : https://github.com/official-stockfish/Stockfish/issues/2451
About the GHI : https://www.chessprogramming.org/Graph_History_Interaction

This patch tries to address the issue in this particular game and similar
reported games: it prevents that values from the transposition table are
getting used when the 50-move counter is close to reaching 100 (). The idea
is that in such cases values from previous searches, with a much lower 50-move
count, become less and less reliable.

More precisely, the heuristic we use in this patch is that we don't take the
transposition table cutoff  when we have reached a 45-moves limit, but let the
search continue doing its job. There is a possible slowdown involved, but it will
also help to find either a draw when it thought to be losing, or a way to avoid
the draw by 50-move rule. This heuristics probably will not fix all possible cases,
but seems to be working reasonably well in practice while not losing too much Elo.

Passed non-regression tests:
STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 274452 W: 59700 L: 60075 D: 154677
http://tests.stockfishchess.org/tests/view/5df546116932658fe9b451bf

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 95235 W: 15297 L: 15292 D: 64646
http://tests.stockfishchess.org/tests/view/5df69c926932658fe9b4520e

Closes https://github.com/official-stockfish/Stockfish/pull/2453

Bench: 4586187

src/search.cpp

index f357db5e43cf8cc37399c0ab26d9a329a6cd5e95..dfc0e5bf79a9b1ef40064de18c85a603dad8ee26 100644 (file)
@@ -716,7 +716,9 @@ namespace {
                 update_continuation_histories(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty);
             }
         }
                 update_continuation_histories(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty);
             }
         }
-        return ttValue;
+
+        if (pos.rule50_count() < 90)
+            return ttValue;
     }
 
     // Step 5. Tablebases probe
     }
 
     // Step 5. Tablebases probe