mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 09:13:08 +00:00
Simplify previous condition
No functional change.
This commit is contained in:
parent
9fc77bc414
commit
0958e5c6d3
1 changed files with 6 additions and 6 deletions
|
@ -642,17 +642,17 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
score += RookHalfOpenFileBonus;
|
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))
|
if (mob > 6 || ei.pi->file_is_half_open(Us, f))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ksq = pos.king_square(Us);
|
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)))
|
// Penalize rooks which are trapped inside a king. Penalize more if
|
||||||
&& (relative_rank(Us, ksq) == RANK_1 && rank_of(ksq) == rank_of(s))
|
// king has lost right to castle.
|
||||||
&& (!ei.pi->has_open_file_on_side(Us, file_of(ksq), left)))
|
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
|
score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2
|
||||||
: (TrappedRookPenalty - mob * 16), 0);
|
: (TrappedRookPenalty - mob * 16), 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue