- 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;
+void TimeManagement::init(Search::LimitsType& limits, Color us, int ply, TimePoint now)
+{
+ int minThinkingTime = Options["Minimum Thinking Time"];
+ int moveOverhead = Options["Move Overhead"];
+ int slowMover = Options["Slow Mover"];
+ int npmsec = Options["nodestime"];
+
+ // 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
+ // real engine speed to avoid time losses.
+ if (npmsec)
+ {
+ if (!availableNodes) // Only once at game start
+ availableNodes = npmsec * limits.time[us]; // Time is in msec