Rename time variable to reflect UCI parameters
authorMarco Costalba <mcostalba@gmail.com>
Thu, 18 Sep 2014 13:44:38 +0000 (15:44 +0200)
committerlucasart <lucas.braesch@gmail.com>
Sun, 21 Sep 2014 00:23:12 +0000 (08:23 +0800)
On top of previous patch, rename time variables to
reflect the simplification of UCI parameters.

It is more correct to use as varibales directly the
corresponding UCI option, without intorducing redundant
intermediate variables.

This allows also to simplify the code.

No functional change.

src/timeman.cpp

index 11405bb..88a52bb 100644 (file)
@@ -89,11 +89,9 @@ void TimeManager::init(const Search::LimitsType& limits, int currentPly, Color u
   int hypMTG, hypMyTime, t1, t2;
 
   // Read uci parameters
-  int emergencyMoveHorizon = 40;
-  int emergencyBaseTime    = Options["Move Overhead"] * 2;
-  int emergencyMoveTime    = Options["Move Overhead"];
-  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 +104,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);