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); } }