- // 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 all to maximum values but unstablePVExtraTime that is reset
- unstablePVExtraTime = 0;
- optimumSearchTime = maximumSearchTime = limits.time[us];
-
- // 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)
- {
- // Calculate thinking time for hypothetical "moves to go"-value
- hypMyTime = limits.time[us]
- + limits.inc[us] * (hypMTG - 1)
- - emergencyBaseTime
- - emergencyMoveTime * std::min(hypMTG, emergencyMoveHorizon);
+ ratio *= 1 + inc / (myTime * 8.5);
+ }
+ // Otherwise we increase usage of remaining time as the game goes on
+ else
+ {
+ double k = 1 + 20 * moveNum / (500.0 + moveNum);
+ ratio = (type == OptimumTime ? 0.017 : 0.07) * (k + inc / myTime);
+ }