From: Joona Kiiski Date: Tue, 8 Dec 2009 17:19:13 +0000 (+0200) Subject: Re-enable TT.insert_pv() X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=b056e5d40ab4e90530df53bb110bd74a41a8df07;p=fairystockfish.git Re-enable TT.insert_pv() This time make sure that valuable TTentries are not overwritten. Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index 7bacb89..96a945e 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 55aad11..a8aa1b6 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); } }