From b056e5d40ab4e90530df53bb110bd74a41a8df07 Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Tue, 8 Dec 2009 19:19:13 +0200 Subject: [PATCH] Re-enable TT.insert_pv() This time make sure that valuable TTentries are not overwritten. Signed-off-by: Marco Costalba --- src/search.cpp | 2 +- src/tt.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 7bacb89c..96a945e6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -743,7 +743,7 @@ namespace { // Write PV to transposition table, in case the relevant entries have // been overwritten during the search. - //TT.insert_pv(p, ss[0].pv); + TT.insert_pv(p, ss[0].pv); if (AbortSearch) break; // Value cannot be trusted. Break out immediately! diff --git a/src/tt.cpp b/src/tt.cpp index 55aad112..a8aa1b65 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -208,7 +208,9 @@ void TranspositionTable::insert_pv(const Position& pos, Move pv[]) { for (int i = 0; pv[i] != MOVE_NONE; i++) { - store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, Depth(-127*OnePly), pv[i]); + TTEntry *tte = retrieve(p.get_key()); + if (!tte || tte->move() != pv[i]) + store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, Depth(-127*OnePly), pv[i]); p.do_move(pv[i], st); } } -- 2.39.2