]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Use minimumSplitDepth = 5
[stockfish] / src / search.cpp
index 4590bd4a1905c6f3e0baa5931f3284487565fe68..f0c1bdd978e14fdc661c2a4041bb220fce343055 100644 (file)
@@ -129,7 +129,6 @@ namespace {
   };
 
   size_t PVIdx;
-  TimeManagement Time;
   EasyMoveManager EasyMove;
   double BestMoveChanges;
   Value DrawValue[COLOR_NB];
@@ -218,11 +217,12 @@ template uint64_t Search::perft<true>(Position& pos, Depth depth);
 
 void Search::think() {
 
-  Time.init(Limits, RootPos.side_to_move(), RootPos.game_ply(), now());
+  Color us = RootPos.side_to_move();
+  Time.init(Limits, us, RootPos.game_ply(), now());
 
   int contempt = Options["Contempt"] * PawnValueEg / 100; // From centipawns
-  DrawValue[ RootPos.side_to_move()] = VALUE_DRAW - Value(contempt);
-  DrawValue[~RootPos.side_to_move()] = VALUE_DRAW + Value(contempt);
+  DrawValue[ us] = VALUE_DRAW - Value(contempt);
+  DrawValue[~us] = VALUE_DRAW + Value(contempt);
 
   TB::Hits = 0;
   TB::RootInTB = false;
@@ -291,6 +291,11 @@ void Search::think() {
       Threads.timer->run = false;
   }
 
+  // When playing in 'nodes as time' mode, subtract the searched nodes from
+  // the available ones before to exit.
+  if (Limits.npmsec)
+      Time.availableNodes += Limits.inc[us] - RootPos.nodes_searched();
+
   // When we reach the maximum depth, we can arrive here without a raise of
   // Signals.stop. However, if we are pondering or in an infinite search,
   // the UCI protocol states that we shouldn't print the best move before the