]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Small codestyle touches
[stockfish] / src / search.cpp
index e1245085cdc880608a21af043de6dcf695d35a73..d54794bbc8712205a066cf977da4f692b3cb4c02 100644 (file)
@@ -52,9 +52,6 @@ using std::endl;
 
 namespace {
 
-  // Maximum number of allowed moves per position
-  const int MOVES_MAX = 256;
-
   // Types
   enum NodeType { NonPV, PV };
 
@@ -366,7 +363,7 @@ void init_search() {
 
   // Init futility move count array
   for (d = 0; d < 32; d++)
-      FutilityMoveCountArray[d] = 3 + (1 << (3 * d / 8));
+      FutilityMoveCountArray[d] = int(3.001 + 0.25 * pow(d, 2.0));
 }
 
 
@@ -633,7 +630,7 @@ namespace {
 
             // Add some extra time if the best move has changed during the last two iterations
             if (Iteration > 5 && Iteration <= 50)
-                TimeMgr.pv_unstability(BestMoveChangesByIteration[Iteration],
+                TimeMgr.pv_instability(BestMoveChangesByIteration[Iteration],
                                        BestMoveChangesByIteration[Iteration-1]);
 
             // Stop search if most of MaxSearchTime is consumed at the end of the
@@ -1434,12 +1431,11 @@ namespace {
             assert(tte->static_value() != VALUE_NONE);
 
             evalMargin = tte->static_value_margin();
-            bestValue = tte->static_value();
+            ss->eval = bestValue = tte->static_value();
         }
         else
-            bestValue = evaluate(pos, evalMargin);
+            ss->eval = bestValue = evaluate(pos, evalMargin);
 
-        ss->eval = bestValue;
         update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval);
 
         // Stand pat. Return immediately if static value is at least beta
@@ -1458,7 +1454,7 @@ namespace {
         deepChecks = (depth == -ONE_PLY && bestValue >= beta - PawnValueMidgame / 8);
 
         // Futility pruning parameters, not needed when in check
-        futilityBase = bestValue + FutilityMarginQS + evalMargin;
+        futilityBase = ss->eval + evalMargin + FutilityMarginQS;
         enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
     }
 
@@ -1498,7 +1494,7 @@ namespace {
           }
       }
 
-      // Detect blocking evasions that are candidate to be pruned
+      // Detect non-capture evasions that are candidate to be pruned
       evasionPrunable =   isCheck
                        && bestValue > value_mated_in(PLY_MAX)
                        && !pos.move_is_capture(move)
@@ -1544,11 +1540,6 @@ namespace {
     ValueType vt = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
     TT.store(pos.get_key(), value_to_tt(bestValue, ply), vt, d, ss->bestMove, ss->eval, evalMargin);
 
-    // Update killers only for checking moves that fails high
-    if (    bestValue >= beta
-        && !pos.move_is_capture_or_promotion(ss->bestMove))
-        update_killers(ss->bestMove, ss);
-
     assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
 
     return bestValue;