]> git.sesse.net Git - stockfish/commitdiff
Fix trapped rook condition
authorMarco Costalba <mcostalba@gmail.com>
Sat, 4 May 2013 10:18:18 +0000 (12:18 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 5 May 2013 10:27:11 +0000 (12:27 +0200)
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

src/evaluate.cpp

index 108f6c8a39e68bf74370b437a1a52b3d58182ff9..6f572f4e4b28854e3658d120b9766a66d572e5b5 100644 (file)
@@ -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)))
             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);
                 && (!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);