From 9a595359628d82026513f7e978d40e944194b057 Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Tue, 24 Nov 2009 23:49:17 +0200 Subject: [PATCH] Remove RootMoveList::scan_for_easy_move() * The function is called only in one place * It must not be called elsewhere * The function call easily replaced with simple one line condition No functional change (tested with usual set + 2000 random positions) Signed-off-by: Marco Costalba --- src/search.cpp | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 4ea01072..8e3e0dab 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -119,7 +119,6 @@ namespace { inline Move get_move_pv(int moveNum, int i) const; inline int64_t get_move_cumulative_nodes(int moveNum) const; inline int move_count() const; - Move scan_for_easy_move() const; inline void sort(); void sort_multipv(int n); @@ -685,7 +684,11 @@ namespace { IterationInfo[1] = IterationInfoType(rml.get_move_score(0), rml.get_move_score(0)); Iteration = 1; - Move EasyMove = rml.scan_for_easy_move(); + // Is one move significantly better than others after initial scoring ? + Move EasyMove = MOVE_NONE; + if ( rml.move_count() == 1 + || rml.get_move_score(0) > rml.get_move_score(1) + EasyMoveMargin) + EasyMove = rml.get_move(0); // Iterative deepening loop while (Iteration < PLY_MAX) @@ -2169,28 +2172,6 @@ namespace { } - // 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; - } - // RootMoveList::sort() sorts the root move list at the beginning of a new // iteration. -- 2.39.2