Skip to content

Commit

Permalink
Fix trapped rook condition
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mcostalba committed May 5, 2013
1 parent 3b92159 commit 9fc77bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/evaluate.cpp
Expand Up @@ -651,7 +651,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
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);
Expand Down

0 comments on commit 9fc77bc

Please sign in to comment.