Skip to content

Commit 0958e5c

Browse files
committed
Simplify previous condition
No functional change.
1 parent 9fc77bc commit 0958e5c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/evaluate.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,17 +642,17 @@ Value do_evaluate(const Position& pos, Value& margin) {
642642
score += RookHalfOpenFileBonus;
643643
}
644644

645-
// Penalize rooks which are trapped inside a king. Penalize more if
646-
// king has lost right to castle.
647645
if (mob > 6 || ei.pi->file_is_half_open(Us, f))
648646
continue;
649647

650648
ksq = pos.king_square(Us);
651-
bool left = file_of(ksq) < FILE_E;
652649

653-
if ( ((left && file_of(s) < file_of(ksq)) || (!left && file_of(s) > file_of(ksq)))
654-
&& (relative_rank(Us, ksq) == RANK_1 && rank_of(ksq) == rank_of(s))
655-
&& (!ei.pi->has_open_file_on_side(Us, file_of(ksq), left)))
650+
// Penalize rooks which are trapped inside a king. Penalize more if
651+
// king has lost right to castle.
652+
if ( ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq)))
653+
&& rank_of(ksq) == rank_of(s)
654+
&& relative_rank(Us, ksq) == RANK_1
655+
&& !ei.pi->has_open_file_on_side(Us, file_of(ksq), file_of(ksq) < FILE_E))
656656
score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2
657657
: (TrappedRookPenalty - mob * 16), 0);
658658
}

0 commit comments

Comments
 (0)