- 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"];
-
- // Initialize unstablePvFactor to 1 and search times to maximum values
- unstablePvFactor = 1;
- optimumSearchTime = maximumSearchTime = std::max(limits.time[us], minThinkingTime);
-
- // We calculate optimum time usage for different hypothetical "moves to go"-values and choose the
- // minimum of calculated search time values. Usually the greatest hypMTG gives the minimum values.
- for (hypMTG = 1; hypMTG <= (limits.movestogo ? std::min(limits.movestogo, MoveHorizon) : MoveHorizon); ++hypMTG)
+void TimeManagement::init(Search::LimitsType& limits, Color us, int ply)
+{
+ int moveOverhead = Options["Move Overhead"];
+ int npmsec = Options["nodestime"];
+ bool ponder = Options["Ponder"];
+
+ // If we have to play in 'nodes as time' mode, then convert from time
+ // to nodes, and use resulting values in time management formulas.
+ // WARNING: Given npms (nodes per millisecond) must be much lower then
+ // the real engine speed to avoid time losses.
+ if (npmsec)