]> git.sesse.net Git - stockfish/blobdiff - src/evaluate.cpp
Revert trapped rook bug fix
[stockfish] / src / evaluate.cpp
index 3a10acbaaaac59886ee63d093e8510127e196aef..607694e00a23dac1d632d03dab44c75dfe12c47b 100644 (file)
@@ -159,9 +159,9 @@ namespace {
   const Score QueenOnPawnBonus       = make_score( 4, 20);
   const Score RookOpenFileBonus      = make_score(43, 21);
   const Score RookHalfOpenFileBonus  = make_score(19, 10);
-  const Score BishopPawnsPenalty     = make_score(8, 12);
+  const Score BishopPawnsPenalty     = make_score( 8, 12);
   const Score UndefendedMinorPenalty = make_score(25, 10);
-  const Score TrappedRookPenalty     = make_score(90, 0);
+  const Score TrappedRookPenalty     = make_score(90,  0);
 
   // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
   // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
@@ -600,8 +600,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
             // Penalize rooks which are trapped inside a king. Penalize more if
             // king has lost right to castle.
             if (   ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq)))
-                && rank_of(ksq) == rank_of(s)
-                && relative_rank(Us, ksq) == RANK_1
+                && (rank_of(ksq) == rank_of(s) || relative_rank(Us, ksq) == RANK_1)
                 && !ei.pi->half_open_on_side(Us, file_of(ksq), file_of(ksq) < FILE_E))
                 score -= (TrappedRookPenalty - make_score(mob * 8, 0)) * (pos.can_castle(Us) ? 1 : 2);
         }