X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftt.cpp;h=a8aa1b6574604d48fb91a513a066e6dedbaec0ae;hp=a16d5cac636496888b9f7e506aad67902907b92c;hb=bc0871acbce42a02ae9bbbfb95529b0a49f7588a;hpb=fd2b3df77083ae60d9233023119d6d0a076070b9 diff --git a/src/tt.cpp b/src/tt.cpp index a16d5cac..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); } } @@ -220,7 +222,7 @@ void TranspositionTable::insert_pv(const Position& pos, Move pv[]) { /// will often get single-move PVs when the search stops while failing high, /// and a single-move PV means that we don't have a ponder move. -void TranspositionTable::extract_pv(const Position& pos, Move pv[], int pvSize) { +void TranspositionTable::extract_pv(const Position& pos, Move pv[], const int PLY_MAX) { const TTEntry* tte; StateInfo st; @@ -236,7 +238,7 @@ void TranspositionTable::extract_pv(const Position& pos, Move pv[], int pvSize) && tte->move() != MOVE_NONE && move_is_legal(p, tte->move()) && (!p.is_draw() || ply < 2) - && ply < pvSize) + && ply < PLY_MAX) { pv[ply] = tte->move(); p.do_move(pv[ply++], st);