+ string uci_pv(const Position& pos, Depth depth, Value alpha, Value beta);
+
+ struct Skill {
+ Skill(int l, size_t rootSize) : level(l),
+ candidates(l < 20 ? std::min(4, (int)rootSize) : 0),
+ best(MOVE_NONE) {}
+ ~Skill() {
+ if (candidates) // Swap best PV line with the sub-optimal one
+ std::swap(RootMoves[0], *std::find(RootMoves.begin(),
+ RootMoves.end(), best ? best : pick_move()));
+ }
+
+ size_t candidates_size() const { return candidates; }
+ bool time_to_pick(Depth depth) const { return depth / ONE_PLY == 1 + level; }
+ Move pick_move();
+
+ int level;
+ size_t candidates;
+ Move best;
+ };