From 9fc77bc4140933a3832941a81e6d239fecc75787 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 4 May 2013 12:18:18 +0200 Subject: [PATCH] Fix trapped rook condition 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 108f6c8a..6f572f4e 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -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); -- 2.39.2