-/// RootMove::extract_pv_from_tt() builds a PV by adding moves from the TT table.
-/// We also consider both failing high nodes and BOUND_EXACT nodes here to
-/// ensure that we have a ponder move even when we fail high at root. This
-/// results in a long PV to print that is important for position analysis.
-
-void RootMove::extract_pv_from_tt(Position& pos) {
-
- StateInfo state[MAX_PLY_PLUS_6], *st = state;
- const TTEntry* tte;
- int ply = 0;
- Move m = pv[0];
-
- pv.clear();
-
- do {
- pv.push_back(m);
-
- assert(MoveList<LEGAL>(pos).contains(pv[ply]));
-
- pos.do_move(pv[ply++], *st++);
- tte = TT.probe(pos.key());
-
- } while ( tte
- && pos.pseudo_legal(m = tte->move()) // Local copy, TT could change
- && pos.legal(m, pos.pinned_pieces(pos.side_to_move()))
- && ply < MAX_PLY
- && (!pos.is_draw() || ply < 2));
-
- pv.push_back(MOVE_NONE); // Must be zero-terminating
-
- while (ply) pos.undo_move(pv[--ply]);
-}
-
-