]> git.sesse.net Git - stockfish/commitdiff
Default argument for see_ge()
authorMarco Costalba <mcostalba@gmail.com>
Tue, 9 May 2017 11:50:05 +0000 (13:50 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 10 May 2017 16:20:45 +0000 (18:20 +0200)
No functional change.

Closes #1111

src/evaluate.cpp
src/movepick.cpp
src/pawns.cpp
src/position.cpp
src/position.h
src/search.cpp

index 9202c9ed3d861d58c5cda2b45be52b9bb6b2557a..3bd790bdf4f7f469a2fa9584eb21a556bd049455 100644 (file)
@@ -174,8 +174,8 @@ namespace {
     S(-20,-12), S( 1, -8), S( 2, 10), S(  9, 10)
   };
 
     S(-20,-12), S( 1, -8), S( 2, 10), S(  9, 10)
   };
 
-  // KingProtector[PieceType-2] * "distance to own king" determines a bonus for each piece.
-  const Score KingProtector[] = {S(-3, -5), S(-4, -3), S(-3, 0), S(-1, 1) };
+  // KingProtector[PieceType-2] contains a bonus according to distance from king
+  const Score KingProtector[] = { S(-3, -5), S(-4, -3), S(-3, 0), S(-1, 1) };
 
   // Assorted bonuses and penalties used by evaluation
   const Score MinorBehindPawn     = S( 16,  0);
 
   // Assorted bonuses and penalties used by evaluation
   const Score MinorBehindPawn     = S( 16,  0);
@@ -291,9 +291,10 @@ namespace {
 
         int mob = popcount(b & ei.mobilityArea[Us]);
 
 
         int mob = popcount(b & ei.mobilityArea[Us]);
 
-        mobility[Us] += MobilityBonus[Pt-2][mob];
+        mobility[Us] += MobilityBonus[Pt - 2][mob];
 
 
-        score += KingProtector[Pt-2] * distance(s, pos.square<KING>(Us));
+        // Bonus for this piece as a king protector
+        score += KingProtector[Pt - 2] * distance(s, pos.square<KING>(Us));
 
         if (Pt == BISHOP || Pt == KNIGHT)
         {
 
         if (Pt == BISHOP || Pt == KNIGHT)
         {
index 5c24666475713691033ee117eb29d69c683281db..6b9f2be059c73cfcf62389a80bd0c5877a293681 100644 (file)
@@ -202,7 +202,7 @@ Move MovePicker::next_move(bool skipQuiets) {
           move = pick_best(cur++, endMoves);
           if (move != ttMove)
           {
           move = pick_best(cur++, endMoves);
           if (move != ttMove)
           {
-              if (pos.see_ge(move, VALUE_ZERO))
+              if (pos.see_ge(move))
                   return move;
 
               // Losing capture, move it to the beginning of the array
                   return move;
 
               // Losing capture, move it to the beginning of the array
index 95d5fb4cfeb5af4da52552430224b3622470d3cc..dab280cce2daea987ddbf9da0f00541dd70f26f5 100644 (file)
@@ -163,12 +163,14 @@ namespace {
             && popcount(phalanx)   >= popcount(leverPush))
             e->passedPawns[Us] |= s;
 
             && popcount(phalanx)   >= popcount(leverPush))
             e->passedPawns[Us] |= s;
 
-        else if (    stoppers == SquareBB[s + Up]
-                 &&  relative_rank(Us, s) >= RANK_5
-                 && (b = (shift<Up>(supported) & ~theirPawns)))
-            while(b)
-                if(!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
+        else if (   stoppers == SquareBB[s + Up]
+                 && relative_rank(Us, s) >= RANK_5)
+        {
+            b = shift<Up>(supported) & ~theirPawns;
+            while (b)
+                if (!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)]))
                     e->passedPawns[Us] |= s;
                     e->passedPawns[Us] |= s;
+        }
 
         // Score this pawn
         if (!neighbours)
 
         // Score this pawn
         if (!neighbours)
@@ -184,7 +186,7 @@ namespace {
             score += Connected[opposed][!!phalanx][more_than_one(supported)][relative_rank(Us, s)];
 
         if (doubled && !supported)
             score += Connected[opposed][!!phalanx][more_than_one(supported)][relative_rank(Us, s)];
 
         if (doubled && !supported)
-           score -= Doubled;
+            score -= Doubled;
 
         if (lever)
             score += Lever[relative_rank(Us, s)];
 
         if (lever)
             score += Lever[relative_rank(Us, s)];
index 03d8bf8ce5f796da279297306f61104165afbc51..0449222e016406f5e2e63804e8f695e5771cf28c 100644 (file)
@@ -65,7 +65,7 @@ PieceType min_attacker(const Bitboard* bb, Square to, Bitboard stmAttackers,
 
   Bitboard b = stmAttackers & bb[Pt];
   if (!b)
 
   Bitboard b = stmAttackers & bb[Pt];
   if (!b)
-      return min_attacker<Pt+1>(bb, to, stmAttackers, occupied, attackers);
+      return min_attacker<Pt + 1>(bb, to, stmAttackers, occupied, attackers);
 
   occupied ^= b & ~(b - 1);
 
 
   occupied ^= b & ~(b - 1);
 
index 2361132fac4e5596cbb08ca369c7fd7364c0d614..2b44ef329f33dca4e3eb7bda87533f2b67d5ad40 100644 (file)
@@ -136,7 +136,7 @@ public:
   void undo_null_move();
 
   // Static Exchange Evaluation
   void undo_null_move();
 
   // Static Exchange Evaluation
-  bool see_ge(Move m, Value value) const;
+  bool see_ge(Move m, Value value = VALUE_ZERO) const;
 
   // Accessing hash keys
   Key key() const;
 
   // Accessing hash keys
   Key key() const;
index 2c9240146b32b46791efcb755a46f3236a83f18c..fc877f3040d0923943a2a21c34f64af2a24b6bbc 100644 (file)
@@ -556,7 +556,7 @@ namespace {
     // Step 1. Initialize node
     Thread* thisThread = pos.this_thread();
     inCheck = pos.checkers();
     // Step 1. Initialize node
     Thread* thisThread = pos.this_thread();
     inCheck = pos.checkers();
-    moveCount = quietCount =  ss->moveCount = 0;
+    moveCount = quietCount = ss->moveCount = 0;
     ss->history = 0;
     bestValue = -VALUE_INFINITE;
     ss->ply = (ss-1)->ply + 1;
     ss->history = 0;
     bestValue = -VALUE_INFINITE;
     ss->ply = (ss-1)->ply + 1;
@@ -895,7 +895,7 @@ moves_loop: // When in check search starts from here
       }
       else if (    givesCheck
                && !moveCountPruning
       }
       else if (    givesCheck
                && !moveCountPruning
-               &&  pos.see_ge(move, VALUE_ZERO))
+               &&  pos.see_ge(move))
           extension = ONE_PLY;
 
       // Calculate new depth for this move
           extension = ONE_PLY;
 
       // Calculate new depth for this move
@@ -979,8 +979,8 @@ moves_loop: // When in check search starts from here
               // Decrease reduction for moves that escape a capture. Filter out
               // castling moves, because they are coded as "king captures rook" and
               // hence break make_move().
               // Decrease reduction for moves that escape a capture. Filter out
               // castling moves, because they are coded as "king captures rook" and
               // hence break make_move().
-              else if (   type_of(move) == NORMAL
-                       && !pos.see_ge(make_move(to_sq(move), from_sq(move)),  VALUE_ZERO))
+              else if (    type_of(move) == NORMAL
+                       && !pos.see_ge(make_move(to_sq(move), from_sq(move))))
                   r -= 2 * ONE_PLY;
 
               ss->history =  cmh[moved_piece][to_sq(move)]
                   r -= 2 * ONE_PLY;
 
               ss->history =  cmh[moved_piece][to_sq(move)]
@@ -1116,7 +1116,6 @@ moves_loop: // When in check search starts from here
                    :     inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
     else if (bestMove)
     {
                    :     inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
     else if (bestMove)
     {
-
         // Quiet best move: update move sorting heuristics
         if (!pos.capture_or_promotion(bestMove))
             update_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth));
         // Quiet best move: update move sorting heuristics
         if (!pos.capture_or_promotion(bestMove))
             update_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth));
@@ -1290,7 +1289,7 @@ moves_loop: // When in check search starts from here
       // Don't search moves with negative SEE values
       if (  (!InCheck || evasionPrunable)
           &&  type_of(move) != PROMOTION
       // Don't search moves with negative SEE values
       if (  (!InCheck || evasionPrunable)
           &&  type_of(move) != PROMOTION
-          &&  !pos.see_ge(move, VALUE_ZERO))
+          &&  !pos.see_ge(move))
           continue;
 
       // Speculative prefetch as early as possible
           continue;
 
       // Speculative prefetch as early as possible