A rook is trapped if on rank 1 as is the king.
Currently the condition aloows for the rook
to be also in front of the pawns as long
as king is on first rank.
Verified with short TC test:
LLR: -1.71 (-2.94,2.94)
Total: 23234 W: 4317 L: 4317 D: 14600
Here what it counts is that after 23K games
result is equal.
bench:
4696542
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))
+ && (relative_rank(Us, ksq) == RANK_1 && rank_of(ksq) == rank_of(s))
&& (!ei.pi->has_open_file_on_side(Us, file_of(ksq), left)))
score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2
: (TrappedRookPenalty - mob * 16), 0);