- for (int k = 0; !includeMove && searchMoves[k] != MOVE_NONE; k++)
- includeMove = (searchMoves[k] == mlist[i].move);
-
- if (!includeMove)
- continue;
-
- // Find a quick score for the move
- StateInfo st;
- SearchStack ss[PLY_MAX_PLUS_2];
-
- moves[count].move = mlist[i].move;
- pos.do_move(moves[count].move, st);
- moves[count].score = -qsearch(pos, ss, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1, 0);
- pos.undo_move(moves[count].move);
- moves[count].pv[0] = moves[count].move;
- moves[count].pv[1] = MOVE_NONE; // FIXME
- count++;
- }
- sort();
- }
-
-
- // Simple accessor methods for the RootMoveList class
-
- inline Move RootMoveList::get_move(int moveNum) const {
- return moves[moveNum].move;
- }
-
- inline Value RootMoveList::get_move_score(int moveNum) const {
- return moves[moveNum].score;
- }
-
- inline void RootMoveList::set_move_score(int moveNum, Value score) {
- moves[moveNum].score = score;
- }
-
- inline void RootMoveList::set_move_nodes(int moveNum, int64_t nodes) {
- moves[moveNum].nodes = nodes;
- moves[moveNum].cumulativeNodes += nodes;
- }
-
- inline void RootMoveList::set_beta_counters(int moveNum, int64_t our, int64_t their) {
- moves[moveNum].ourBeta = our;
- moves[moveNum].theirBeta = their;
- }
-
- void RootMoveList::set_move_pv(int moveNum, const Move pv[]) {
- int j;
- for(j = 0; pv[j] != MOVE_NONE; j++)
- moves[moveNum].pv[j] = pv[j];
- moves[moveNum].pv[j] = MOVE_NONE;
- }
-
- inline Move RootMoveList::get_move_pv(int moveNum, int i) const {
- return moves[moveNum].pv[i];
- }
-
- inline int64_t RootMoveList::get_move_cumulative_nodes(int moveNum) const {
- return moves[moveNum].cumulativeNodes;
- }
-
- inline int RootMoveList::move_count() const {
- return count;
- }
-
-
- // RootMoveList::scan_for_easy_move() is called at the end of the first
- // iteration, and is used to detect an "easy move", i.e. a move which appears
- // to be much bester than all the rest. If an easy move is found, the move
- // is returned, otherwise the function returns MOVE_NONE. It is very
- // important that this function is called at the right moment: The code
- // assumes that the first iteration has been completed and the moves have
- // been sorted. This is done in RootMoveList c'tor.
-
- Move RootMoveList::scan_for_easy_move() const {
-
- assert(count);
-
- if (count == 1)
- return get_move(0);
-
- // moves are sorted so just consider the best and the second one
- if (get_move_score(0) > get_move_score(1) + EasyMoveMargin)
- return get_move(0);
-
- return MOVE_NONE;
- }