From: Leonid Pechenik Date: Thu, 20 Feb 2014 07:38:10 +0000 (+0100) Subject: Distribute part of first move time to other moves X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=b8cfc255d46113573a0869e56224a382c74dfcdc Distribute part of first move time to other moves Passed both short TC: LLR: 2.97 (-2.94,2.94) [-1.50,4.50] Total: 18907 W: 3475 L: 3322 D: 12110 And long TC: LLR: 2.96 (-2.94,2.94) [0.00,6.00] Total: 19044 W: 2997 L: 2811 D: 13236 bench: 8430785 --- diff --git a/src/search.cpp b/src/search.cpp index 0d1a401c..da22c5cf 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -43,7 +43,7 @@ namespace Search { std::vector RootMoves; Position RootPos; Color RootColor; - Time::point SearchTime, IterationTime; + Time::point SearchTime; StateStackPtr SetupStates; } @@ -397,7 +397,7 @@ namespace { sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl; } - IterationTime = Time::now() - SearchTime; + Time::point iterationTime = Time::now() - SearchTime; // If skill levels are enabled and time is up, pick a sub-optimal best move if (skill.enabled() && skill.time_to_pick(depth)) @@ -432,7 +432,7 @@ namespace { // Stop the search if only one legal move is available or all // of the available time has been used. if ( RootMoves.size() == 1 - || IterationTime > TimeMgr.available_time() ) + || iterationTime > TimeMgr.available_time() ) stop = true; if (stop) @@ -1627,8 +1627,7 @@ void check_time() { Time::point elapsed = Time::now() - SearchTime; bool stillAtFirstMove = Signals.firstRootMove && !Signals.failedLowAtRoot - && elapsed > TimeMgr.available_time() - && elapsed > IterationTime * 1.4; + && elapsed > TimeMgr.available_time() * 75 / 100; bool noMoreTime = elapsed > TimeMgr.maximum_time() - 2 * TimerThread::Resolution || stillAtFirstMove; diff --git a/src/search.h b/src/search.h index 2fd8d47d..3752dd70 100644 --- a/src/search.h +++ b/src/search.h @@ -100,7 +100,7 @@ extern LimitsType Limits; extern std::vector RootMoves; extern Position RootPos; extern Color RootColor; -extern Time::point SearchTime, IterationTime; +extern Time::point SearchTime; extern StateStackPtr SetupStates; extern void init(); diff --git a/src/timeman.h b/src/timeman.h index 5a98f614..90bd1867 100644 --- a/src/timeman.h +++ b/src/timeman.h @@ -27,7 +27,7 @@ class TimeManager { public: void init(const Search::LimitsType& limits, int currentPly, Color us); void pv_instability(double bestMoveChanges); - int available_time() const { return int(optimumSearchTime * unstablePvFactor * 0.62); } + int available_time() const { return int(optimumSearchTime * unstablePvFactor * 0.71); } int maximum_time() const { return maximumSearchTime; } private: