]> git.sesse.net Git - stockfish/commitdiff
Simplify previous condition
authorMarco Costalba <mcostalba@gmail.com>
Sat, 4 May 2013 10:27:19 +0000 (12:27 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 5 May 2013 10:31:32 +0000 (12:31 +0200)
No functional change.

src/evaluate.cpp

index 6f572f4e4b28854e3658d120b9766a66d572e5b5..fe4eef57493c8ed3a601120dc7fee3233e7a1b5d 100644 (file)
@@ -642,17 +642,17 @@ Value do_evaluate(const Position& pos, Value& margin) {
                     score += RookHalfOpenFileBonus;
             }
 
-            // Penalize rooks which are trapped inside a king. Penalize more if
-            // king has lost right to castle.
             if (mob > 6 || ei.pi->file_is_half_open(Us, f))
                 continue;
 
             ksq = pos.king_square(Us);
-            bool left = file_of(ksq) < FILE_E;
 
-            if (   ((left && file_of(s) < file_of(ksq)) || (!left && file_of(s) > file_of(ksq)))
-                && (relative_rank(Us, ksq) == RANK_1 && rank_of(ksq) == rank_of(s))
-                && (!ei.pi->has_open_file_on_side(Us, file_of(ksq), left)))
+            // 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
+                && !ei.pi->has_open_file_on_side(Us, file_of(ksq), file_of(ksq) < FILE_E))
                 score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2
                                                        : (TrappedRookPenalty - mob * 16), 0);
         }