]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Retire move_ambiguity() altogether
[stockfish] / src / search.cpp
index 3f367d83bd0218fed704ad6d720d3c0eb2c9a2a9..9a3ecbbefaf8fecaa63b67c161731f6e5ee4b25d 100644 (file)
@@ -578,8 +578,15 @@ bool think(Position& pos, bool infinite, bool ponder, int time[], int increment[
   if (!StopRequest && (Pondering || InfiniteSearch))
       wait_for_stop_or_ponderhit();
 
-  // Could be both MOVE_NONE when searching on a stalemate position
-  cout << "bestmove " << bestMove << " ponder " << ponderMove << endl;
+  // Could be MOVE_NONE when searching on a stalemate position
+  cout << "bestmove " << bestMove;
+
+  // UCI protol is not clear on allowing sending an empty ponder move, instead
+  // it is clear that ponder move is optional. So skip it if empty.
+  if (ponderMove != MOVE_NONE)
+      cout << " ponder " << ponderMove;
+
+  cout << endl;
 
   return !QuitRequest;
 }
@@ -596,7 +603,7 @@ namespace {
     SearchStack ss[PLY_MAX_PLUS_2];
     Value bestValues[PLY_MAX_PLUS_2];
     int bestMoveChanges[PLY_MAX_PLUS_2];
-    int depth, researchCountFL, researchCountFH, aspirationDelta;
+    int depth, aspirationDelta;
     Value value, alpha, beta;
     Move bestMove, easyMove;
 
@@ -625,7 +632,7 @@ namespace {
     // Iterative deepening loop
     while (++depth <= PLY_MAX && (!MaxDepth || depth <= MaxDepth) && !StopRequest)
     {
-        Rml.bestMoveChanges = researchCountFL = researchCountFH = 0;
+        Rml.bestMoveChanges = 0;
         cout << "info depth " << depth << endl;
 
         // Calculate dynamic aspiration window based on previous iterations
@@ -666,16 +673,16 @@ namespace {
             // otherwise exit the fail high/low loop.
             if (value >= beta)
             {
-                beta = Min(beta + aspirationDelta * (1 << researchCountFH), VALUE_INFINITE);
-                researchCountFH++;
+                beta = Min(beta + aspirationDelta, VALUE_INFINITE);
+                aspirationDelta += aspirationDelta / 2;
             }
             else if (value <= alpha)
             {
                 AspirationFailLow = true;
                 StopOnPonderhit = false;
 
-                alpha = Max(alpha - aspirationDelta * (1 << researchCountFL), -VALUE_INFINITE);
-                researchCountFL++;
+                alpha = Max(alpha - aspirationDelta, -VALUE_INFINITE);
+                aspirationDelta += aspirationDelta / 2;
             }
             else
                 break;