]> git.sesse.net Git - stockfish/commitdiff
Don't update bestValue in check_is_dangerous()
authorMarco Costalba <mcostalba@gmail.com>
Mon, 20 Feb 2012 13:07:43 +0000 (14:07 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 21 Feb 2012 19:29:05 +0000 (20:29 +0100)
It is a prerequisite for next patch and simplifies
the function. testing at ultra fast TC shows no
regression.

After 24302 games at 2"+0.05
Mod vs Orig 5122 - 5038 - 13872 ELO +1 (+- 2.9)

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

index 28e231dd98a0811529b165e14b1671e3d6e47fae..e53baabd98903430ae37bdc78d4bf64e3e4525bf 100644 (file)
@@ -130,7 +130,7 @@ namespace {
   Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
 
   void id_loop(Position& pos);
   Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
 
   void id_loop(Position& pos);
-  bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta, Value *bValue);
+  bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta);
   bool connected_moves(const Position& pos, Move m1, Move m2);
   Value value_to_tt(Value v, int ply);
   Value value_from_tt(Value v, int ply);
   bool connected_moves(const Position& pos, Move m1, Move m2);
   Value value_to_tt(Value v, int ply);
   Value value_from_tt(Value v, int ply);
@@ -1279,7 +1279,7 @@ split_point_start: // At split points actual search starts from here
           &&  move != ttMove
           && !pos.is_capture_or_promotion(move)
           &&  ss->eval + PawnValueMidgame / 4 < beta
           &&  move != ttMove
           && !pos.is_capture_or_promotion(move)
           &&  ss->eval + PawnValueMidgame / 4 < beta
-          && !check_is_dangerous(pos, move, futilityBase, beta, &bestValue))
+          && !check_is_dangerous(pos, move, futilityBase, beta))
           continue;
 
       // Check for legality only before to do the move
           continue;
 
       // Check for legality only before to do the move
@@ -1330,13 +1330,12 @@ split_point_start: // At split points actual search starts from here
   // bestValue is updated only when returning false because in that case move
   // will be pruned.
 
   // bestValue is updated only when returning false because in that case move
   // will be pruned.
 
-  bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta, Value *bestValue)
+  bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta)
   {
     Bitboard b, occ, oldAtt, newAtt, kingAtt;
   {
     Bitboard b, occ, oldAtt, newAtt, kingAtt;
-    Square from, to, ksq, victimSq;
+    Square from, to, ksq;
     Piece pc;
     Color them;
     Piece pc;
     Color them;
-    Value futilityValue, bv = *bestValue;
 
     from = from_sq(move);
     to = to_sq(move);
 
     from = from_sq(move);
     to = to_sq(move);
@@ -1361,23 +1360,13 @@ split_point_start: // At split points actual search starts from here
 
     // Rule 3. Creating new double threats with checks
     b = pos.pieces(them) & newAtt & ~oldAtt & ~(1ULL << ksq);
 
     // Rule 3. Creating new double threats with checks
     b = pos.pieces(them) & newAtt & ~oldAtt & ~(1ULL << ksq);
-
     while (b)
     {
     while (b)
     {
-        victimSq = pop_1st_bit(&b);
-        futilityValue = futilityBase + PieceValueEndgame[pos.piece_on(victimSq)];
-
         // Note that here we generate illegal "double move"!
         // Note that here we generate illegal "double move"!
-        if (   futilityValue >= beta
-            && pos.see_sign(make_move(from, victimSq)) >= 0)
+        if (futilityBase + PieceValueEndgame[pos.piece_on(pop_1st_bit(&b))] >= beta)
             return true;
             return true;
-
-        if (futilityValue > bv)
-            bv = futilityValue;
     }
 
     }
 
-    // Update bestValue only if check is not dangerous (because we will prune the move)
-    *bestValue = bv;
     return false;
   }
 
     return false;
   }