]> git.sesse.net Git - stockfish/commitdiff
Rename futilityMargin in kingDanger in EvalInfo
authorMarco Costalba <mcostalba@gmail.com>
Thu, 6 May 2010 12:22:53 +0000 (14:22 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 7 May 2010 11:04:22 +0000 (12:04 +0100)
This is what actually is.

A standard naming convention suggests to name a variable
with someting resembling _what_ the variable is and not
_how_ the variable is used. This normally results
in easier to read code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/evaluate.cpp
src/evaluate.h
src/search.cpp

index 65fd691ada7e3b55f8c203f3c8b76fa5fe391109..2169a1ac8995d9d37474e6289c00302708ffd3c0 100644 (file)
@@ -837,14 +837,13 @@ namespace {
       // out of bounds errors.
       attackUnits = Min(99, Max(0, attackUnits));
 
-      // Finally, extract the king danger score from the KingDangerTable[] array.
-      // Subtract the score from evaluation, and set ei.futilityMargin[].
-      // The reason for storing the king danger score to futility margin
-      // is that the king danger scores can sometimes be very big, and that
-      // capturing a single attacking piece can therefore result in a score
-      // change far bigger than the value of the captured piece.
+      // Finally, extract the king danger score from the KingDangerTable[]
+      // array and subtract the score from evaluation. Set also ei.kingDanger[]
+      // value that will be used for pruning because this value can sometimes
+      // be very big, and so capturing a single attacking piece can therefore
+      // result in a score change far bigger than the value of the captured piece.
       ei.value -= Sign[Us] * KingDangerTable[Us][attackUnits];
-      ei.futilityMargin[Us] = mg_value(KingDangerTable[Us][attackUnits]);
+      ei.kingDanger[Us] = mg_value(KingDangerTable[Us][attackUnits]);
     }
   }
 
index af763b2ba8c99f2139fc10e522a12bf6fe74af95..ddae4b7e6e1f4d1b3376c24e404a9a3804a8a2e9 100644 (file)
@@ -47,7 +47,7 @@ class Position;
 
 struct EvalInfo {
 
-  EvalInfo() { futilityMargin[0] = futilityMargin[1] = Value(0); }
+  EvalInfo() { kingDanger[0] = kingDanger[1] = Value(0); }
 
   // Middle game and endgame evaluations
   Score value;
@@ -95,9 +95,8 @@ struct EvalInfo {
   // Middle game and endgame mobility scores
   Score mobility;
 
-  // Extra futility margin. This is added to the standard futility margin
-  // in the quiescence search. One for each color.
-  Value futilityMargin[2];
+  // Value of the danger for the king of the given color
+  Value kingDanger[2];
 };
 
 
index ed7d6a3499e1838b025fb43b0328ee561bb93edc..7cc51c60cb4f23e474f687e8e9c601a0b8d4c116 100644 (file)
@@ -1654,7 +1654,7 @@ namespace {
     if (bestValue >= beta)
     {
         // Store the score to avoid a future costly evaluation() call
-        if (!isCheck && !tte && ei.futilityMargin[pos.side_to_move()] == 0)
+        if (!isCheck && !tte && ei.kingDanger[pos.side_to_move()] == 0)
             TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EV_LO, Depth(-127*OnePly), MOVE_NONE);
 
         return bestValue;
@@ -1673,7 +1673,7 @@ namespace {
     MovePicker mp = MovePicker(pos, ttMove, deepChecks ? Depth(0) : depth, H);
     CheckInfo ci(pos);
     enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
-    futilityBase = staticValue + FutilityMarginQS + ei.futilityMargin[pos.side_to_move()];
+    futilityBase = staticValue + FutilityMarginQS + ei.kingDanger[pos.side_to_move()];
 
     // Loop through the moves until no moves remain or a beta cutoff occurs
     while (   alpha < beta
@@ -1753,7 +1753,7 @@ namespace {
     {
         // If bestValue isn't changed it means it is still the static evaluation
         // of the node, so keep this info to avoid a future evaluation() call.
-        ValueType type = (bestValue == staticValue && !ei.futilityMargin[pos.side_to_move()] ? VALUE_TYPE_EV_UP : VALUE_TYPE_UPPER);
+        ValueType type = (bestValue == staticValue && !ei.kingDanger[pos.side_to_move()] ? VALUE_TYPE_EV_UP : VALUE_TYPE_UPPER);
         TT.store(pos.get_key(), value_to_tt(bestValue, ply), type, d, MOVE_NONE);
     }
     else if (bestValue >= beta)