X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftimeman.cpp;h=86c1d634e1e4bdef95f348e750a1f2b68b1cd2f2;hp=2092b7299ed1c3b78ac9b53178bf5e61e7672d8d;hb=f9571e8d57381275f08ffbfb960358319d4c34dd;hpb=17cb7e7fa3cbc707be1df6793de1928fcb0c6219 diff --git a/src/timeman.cpp b/src/timeman.cpp index 2092b729..86c1d634 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -23,7 +23,7 @@ #include "search.h" #include "timeman.h" -#include "ucioption.h" +#include "uci.h" namespace { @@ -63,7 +63,7 @@ namespace { double ratio1 = (TMaxRatio * thisMoveImportance) / (TMaxRatio * thisMoveImportance + otherMovesImportance); double ratio2 = (thisMoveImportance + TStealRatio * otherMovesImportance) / (thisMoveImportance + otherMovesImportance); - return int(floor(myTime * std::min(ratio1, ratio2))); + return int(myTime * std::min(ratio1, ratio2)); } } // namespace @@ -77,23 +77,14 @@ void TimeManager::init(const Search::LimitsType& limits, int currentPly, Color u increment == 0 && movesToGo != 0 means: x moves in y minutes increment > 0 && movesToGo == 0 means: x basetime + z increment increment > 0 && movesToGo != 0 means: x moves in y minutes + z increment - - Time management is adjusted by following UCI parameters: - - emergencyMoveHorizon: Be prepared to always play at least this many moves - emergencyBaseTime : Always attempt to keep at least this much time (in ms) at clock - emergencyMoveTime : Plus attempt to keep at least this much time for each remaining emergency move - minThinkingTime : No matter what, use at least this much thinking before doing the move */ int hypMTG, hypMyTime, t1, t2; // Read uci parameters - int emergencyMoveHorizon = Options["Emergency Move Horizon"]; - int emergencyBaseTime = Options["Emergency Base Time"]; - int emergencyMoveTime = Options["Emergency Move Time"]; - int minThinkingTime = Options["Minimum Thinking Time"]; - int slowMover = Options["Slow Mover"]; + int moveOverhead = Options["Move Overhead"]; + int minThinkingTime = Options["Minimum Thinking Time"]; + int slowMover = Options["Slow Mover"]; // Initialize unstablePvFactor to 1 and search times to maximum values unstablePvFactor = 1; @@ -106,8 +97,7 @@ void TimeManager::init(const Search::LimitsType& limits, int currentPly, Color u // Calculate thinking time for hypothetical "moves to go"-value hypMyTime = limits.time[us] + limits.inc[us] * (hypMTG - 1) - - emergencyBaseTime - - emergencyMoveTime * std::min(hypMTG, emergencyMoveHorizon); + - moveOverhead * (2 + std::min(hypMTG, 40)); hypMyTime = std::max(hypMyTime, 0);