- StateInfo state[MAX_PLY_PLUS_2], *st = state;
- TTEntry* tte;
- int ply = 1;
- Move m = pv[0];
-
- assert(m != MOVE_NONE && pos.is_pseudo_legal(m));
-
- pv.clear();
- pv.push_back(m);
- pos.do_move(m, *st++);
-
- while ( (tte = TT.probe(pos.key())) != NULL
- && tte->move() != MOVE_NONE
- && pos.is_pseudo_legal(tte->move())
- && pos.pl_move_is_legal(tte->move(), pos.pinned_pieces())
- && ply < MAX_PLY
- && (!pos.is_draw<false>() || ply < 2))
- {
- pv.push_back(tte->move());
- pos.do_move(tte->move(), *st++);
- ply++;
- }
- pv.push_back(MOVE_NONE);