]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Don't access std::cout from Position::print()
[stockfish] / src / search.cpp
index 35a396814d676f4878738150ddd129d20e551bb1..c80a064dfde82ba15f1eb98550d9eda5ebf11107 100644 (file)
@@ -218,7 +218,7 @@ void Search::think() {
   if (Options["Use Search Log"])
   {
       Log log(Options["Search Log Filename"]);
-      log << "\nSearching: "  << RootPos.to_fen()
+      log << "\nSearching: "  << RootPos.fen()
           << "\ninfinite: "   << Limits.infinite
           << " ponder: "      << Limits.ponder
           << " time: "        << Limits.time[RootColor]
@@ -483,8 +483,7 @@ namespace {
     Depth ext, newDepth;
     Value bestValue, value, ttValue;
     Value eval, nullValue, futilityValue;
-    CheckType givesCheck;
-    bool inCheck, pvMove, singularExtensionNode;
+    bool inCheck, givesCheck, pvMove, singularExtensionNode;
     bool captureOrPromotion, dangerous, doFullDepthSearch;
     int moveCount, playedMoveCount;
 
@@ -816,7 +815,7 @@ split_point_start: // At split points actual search starts from here
       if (PvNode && dangerous)
           ext = ONE_PLY;
 
-      else if (givesCheck && (givesCheck == DISCO_CHECK || pos.see_sign(move) >= 0))
+      else if (givesCheck && pos.see_sign(move) >= 0)
           ext = ONE_PLY / 2;
 
       // Singular extension search. If all moves but one fail low on a search of
@@ -883,7 +882,6 @@ split_point_start: // At split points actual search starts from here
 
           // Prune moves with negative SEE at low depths
           if (   predictedDepth < 2 * ONE_PLY
-              && givesCheck != DISCO_CHECK
               && pos.see_sign(move) < 0)
           {
               if (SpNode)
@@ -1103,11 +1101,14 @@ split_point_start: // At split points actual search starts from here
     const TTEntry* tte;
     Key posKey;
     Move ttMove, move, bestMove;
-    Value bestValue, value, ttValue, futilityValue, futilityBase;
-    CheckType givesCheck;
-    bool enoughMaterial, evasionPrunable, fromNull;
+    Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha;
+    bool givesCheck, enoughMaterial, evasionPrunable, fromNull;
     Depth ttDepth;
 
+    // To flag BOUND_EXACT a node with eval above alpha and no available moves
+    if (PvNode)
+        oldAlpha = alpha;
+
     ss->currentMove = bestMove = MOVE_NONE;
     ss->ply = (ss-1)->ply + 1;
     fromNull = (ss-1)->currentMove == MOVE_NULL;
@@ -1237,7 +1238,6 @@ split_point_start: // At split points actual search starts from here
       if (   !PvNode
           && (!InCheck || evasionPrunable)
           &&  move != ttMove
-          &&  givesCheck != DISCO_CHECK
           &&  type_of(move) != PROMOTION
           &&  pos.see_sign(move) < 0)
           continue;
@@ -1295,7 +1295,7 @@ split_point_start: // At split points actual search starts from here
         return mated_in(ss->ply); // Plies to mate from the root
 
     TT.store(posKey, value_to_tt(bestValue, ss->ply),
-             PvNode && bestMove != MOVE_NONE ? BOUND_EXACT : BOUND_UPPER,
+             PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER,
              ttDepth, bestMove, ss->staticEval, ss->evalMargin);
 
     assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);