]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Merge branch 'simplify_eval' into bishop_pin_clop
[stockfish] / src / evaluate.cpp
index e29b9b0f43ba9306fc39425a4bdadec829b9244d..56bcbc683e521232ba24a016d8d19e8f1759689a 100644 (file)
@@ -150,6 +150,8 @@ namespace {
 
   #undef S
 
+  Score BishopPinBonus = make_score(66, 11);
+
   // Bonus for having the side to move (modified by Joona Kiiski)
   const Score Tempo = make_score(24, 11);
 
@@ -306,6 +308,8 @@ namespace Eval {
         KingDangerTable[0][i] = apply_weight(make_score(t, 0), make_score(KingDanger[0], 0));
         KingDangerTable[1][i] = apply_weight(make_score(t, 0), make_score(KingDanger[1], 0));
     }
+
+    BishopPinBonus = make_score(Options["pin_open"], Options["pin_end"]);
   }
 
 
@@ -577,16 +581,15 @@ Value do_evaluate(const Position& pos, Value& margin) {
 
         mobility += MobilityBonus[Piece][mob];
 
-        if (Piece == BISHOP && (PseudoAttacks[Piece][pos.king_square(Them)] & s)) {
-             const Bitboard between = BetweenBB[s][pos.king_square(Them)] & pos.pieces();
-             if (!more_than_one(between))
-                 score += make_score(25, 25);
-        }
-
         // Decrease score if we are attacked by an enemy pawn. Remaining part
         // of threat evaluation must be done later when we have full attack info.
         if (ei.attackedBy[Them][PAWN] & s)
             score -= ThreatenedByPawnPenalty[Piece];
+        else if (Piece == BISHOP && (PseudoAttacks[Piece][pos.king_square(Them)] & s)) {
+             const Bitboard between = BetweenBB[s][pos.king_square(Them)] & pos.pieces();
+             if (!more_than_one(between))
+                 score += BishopPinBonus;
+        }
 
         // Bishop and knight outposts squares
         if (    (Piece == BISHOP || Piece == KNIGHT)