- TM.nodes_searched(), value, t, pv) << endl;
+ ThreadsMgr.nodes_searched(), value, t, pv) << endl;
+ }
+ }
+
+
+ // insert_pv_in_tt() is called at the end of a search iteration, and inserts
+ // the PV back into the TT. This makes sure the old PV moves are searched
+ // first, even if the old TT entries have been overwritten.
+
+ void insert_pv_in_tt(const Position& pos, Move pv[]) {
+
+ StateInfo st;
+ TTEntry* tte;
+ Position p(pos, pos.thread());
+ Value v, m = VALUE_NONE;
+
+ for (int i = 0; pv[i] != MOVE_NONE; i++)
+ {
+ tte = TT.retrieve(p.get_key());
+ if (!tte || tte->move() != pv[i])
+ {
+ v = (p.is_check() ? VALUE_NONE : evaluate(p, m));
+ TT.store(p.get_key(), VALUE_NONE, VALUE_TYPE_NONE, DEPTH_NONE, pv[i], v, m);
+ }
+ p.do_move(pv[i], st);