- Value refine_eval(const TTEntry* tte, Value defaultEval, int ply);
- Move do_skill_level();
- int elapsed_time(bool reset = false);
- string score_to_uci(Value v, Value alpha = -VALUE_INFINITE, Value beta = VALUE_INFINITE);
- void pv_info_to_log(Position& pos, int depth, Value score, int time, Move pv[]);
- void pv_info_to_uci(const Position& pos, int depth, Value alpha, Value beta);
-
- // MovePickerExt class template extends MovePicker and allows to choose at
- // compile time the proper moves source according to the type of node. In the
- // default case we simply create and use a standard MovePicker object.
- template<bool SpNode> struct MovePickerExt : public MovePicker {
-
- MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, Stack* ss, Value b)
- : MovePicker(p, ttm, d, h, ss, b) {}
- };
-
- // In case of a SpNode we use split point's shared MovePicker object as moves source
- template<> struct MovePickerExt<true> : public MovePicker {
-
- MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, Stack* ss, Value b)
- : MovePicker(p, ttm, d, h, ss, b), mp(ss->sp->mp) {}
-
- Move next_move() { return mp->next_move(); }
- MovePicker* mp;
- };
-
- // is_dangerous() checks whether a move belongs to some classes of known
- // 'dangerous' moves so that we avoid to prune it.
- FORCE_INLINE bool is_dangerous(const Position& pos, Move m, bool captureOrPromotion) {
-
- // Test for a pawn pushed to 7th or a passed pawn move
- if (type_of(pos.piece_on(move_from(m))) == PAWN)
- {
- Color c = pos.side_to_move();
- if ( relative_rank(c, move_to(m)) == RANK_7
- || pos.pawn_is_passed(c, move_to(m)))
- return true;
+ string uci_pv(const Position& pos, int depth, Value alpha, Value beta);
+
+ struct Skill {
+ Skill(int l) : level(l), best(MOVE_NONE) {}
+ ~Skill() {
+ if (enabled()) // Swap best PV line with the sub-optimal one
+ std::swap(RootMoves[0], *std::find(RootMoves.begin(),
+ RootMoves.end(), best ? best : pick_move()));