From: Tord Romstad Date: Thu, 8 Oct 2009 06:55:25 +0000 (+0200) Subject: Use slightly lower polling frequency in the last few seconds. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=225dcfeeb7d9097600b9b45af6976254d0faaa3c;ds=sidebyside Use slightly lower polling frequency in the last few seconds. 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. --- diff --git a/src/search.cpp b/src/search.cpp index a0215bee..6dd854c6 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -471,10 +471,12 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, NodesBetweenPolls = Min(MaxNodes, 30000); InfiniteSearch = true; // HACK } + else if (InfiniteSearch) + NodesBetweenPolls = 30000; else if (myTime < 1000) - NodesBetweenPolls = 100; - else if (myTime < 5000) NodesBetweenPolls = 1000; + else if (myTime < 5000) + NodesBetweenPolls = 5000; else NodesBetweenPolls = 30000;