]> git.sesse.net Git - stockfish/blobdiff - src/timeman.cpp
Introduce TimeManager class
[stockfish] / src / timeman.cpp
index 3798a96f4cd109e869645466726c85b625d65271..fb817e56d5ddfd8f1345b87e36855bb0712f2936 100644 (file)
@@ -25,6 +25,7 @@
 #include <cmath>
 
 #include "misc.h"
+#include "timeman.h"
 #include "ucioption.h"
 
 ////
@@ -87,8 +88,8 @@ namespace {
 //// Functions
 ////
 
-void get_search_times(int myTime, int myInc, int movesToGo, int currentPly,
-                      int* optimumSearchTime, int* maximumSearchTime)
+void TimeManager::update(int myTime, int myInc, int movesToGo, int currentPly,
+                         int* optimumSearchTime, int* maximumSearchTime)
 {
   /* We support four different kind of time controls:
 
@@ -130,6 +131,9 @@ void get_search_times(int myTime, int myInc, int movesToGo, int currentPly,
       *maximumSearchTime = Min(*maximumSearchTime, aTime);
   }
 
+  if (get_option_value_bool("Ponder"))
+      *optimumSearchTime += *optimumSearchTime / 4;
+
   // Make sure that maxSearchTime is not over absoluteMaxSearchTime
   *optimumSearchTime = Min(*optimumSearchTime, *maximumSearchTime);
 }