]> git.sesse.net Git - stockfish/commitdiff
Minor change to time management code, to make sure we don't lose on
authorTord Romstad <tord@glaurungchess.com>
Wed, 7 Oct 2009 16:27:00 +0000 (18:27 +0200)
committerTord Romstad <tord@glaurungchess.com>
Wed, 7 Oct 2009 16:27:00 +0000 (18:27 +0200)
time at the last move before the time control when there is very
little time left.

src/search.cpp

index 78b85485d1efcf24ac9b53e11eb383c797f8ed05..a0215bee2741e34adf2c47de4d41a5a9b6305ba1 100644 (file)
@@ -446,7 +446,8 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
       if (movesToGo == 1)
       {
           MaxSearchTime = myTime / 2;
       if (movesToGo == 1)
       {
           MaxSearchTime = myTime / 2;
-          AbsoluteMaxSearchTime = Min(myTime / 2, myTime - 500);
+          AbsoluteMaxSearchTime = 
+             (myTime > 3000)? (myTime - 500) : ((myTime * 3) / 4);
       } else {
           MaxSearchTime = myTime / Min(movesToGo, 20);
           AbsoluteMaxSearchTime = Min((4 * myTime) / movesToGo, myTime / 3);
       } else {
           MaxSearchTime = myTime / Min(movesToGo, 20);
           AbsoluteMaxSearchTime = Min((4 * myTime) / movesToGo, myTime / 3);
@@ -470,6 +471,10 @@ 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 (myTime < 1000)
+      NodesBetweenPolls = 100;
+  else if (myTime < 5000)
+      NodesBetweenPolls = 1000;
   else
       NodesBetweenPolls = 30000;
 
   else
       NodesBetweenPolls = 30000;