]> git.sesse.net Git - stockfish/commitdiff
Use slightly lower polling frequency in the last few seconds.
authorTord Romstad <tord@glaurungchess.com>
Thu, 8 Oct 2009 06:55:25 +0000 (08:55 +0200)
committerTord Romstad <tord@glaurungchess.com>
Thu, 8 Oct 2009 06:55:25 +0000 (08:55 +0200)
Instead of checking the time every 100 nodes in the last second,
and every 1000 nodes in the last five seconds, Stockfish now checks
every 1000 nodes in the last second and every 5000 nodes in the last
five seconds.  This was tested in 1036 games at a time control of
40 moves/10 seconds, and no losses on time occured.

Also fixed a bug pointed out by Marco:  In infinite mode, myTime
is actually 0, but of course we still don't want to check the time
more frequently than the standard once per 30000 nodes in this
case.

src/search.cpp

index a0215bee2741e34adf2c47de4d41a5a9b6305ba1..6dd854c68689c6a5c16b767eeaa9686e89e3cf8b 100644 (file)
@@ -471,10 +471,12 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
       NodesBetweenPolls = Min(MaxNodes, 30000);
       InfiniteSearch = true; // HACK
   }
       NodesBetweenPolls = Min(MaxNodes, 30000);
       InfiniteSearch = true; // HACK
   }
+  else if (InfiniteSearch)
+      NodesBetweenPolls = 30000;
   else if (myTime < 1000)
   else if (myTime < 1000)
-      NodesBetweenPolls = 100;
-  else if (myTime < 5000)
       NodesBetweenPolls = 1000;
       NodesBetweenPolls = 1000;
+  else if (myTime < 5000)
+      NodesBetweenPolls = 5000;
   else
       NodesBetweenPolls = 30000;
 
   else
       NodesBetweenPolls = 30000;