From: homoSapiensSapiens Date: Thu, 22 Aug 2013 14:19:58 +0000 (+0300) Subject: Bonus for rook behind a passed X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=4b9e33854180ddba931a1f61368e2991a55a9651;hp=a0cf424cfc7344d95c60a6f5862eb02cf75c773a Bonus for rook behind a passed If our rook is behind a passed pawn, all squares are defended. One of the longest tests to pass ! Passed both short TC LLR: 2.97 (-2.94,2.94) Total: 44560 W: 9518 L: 9281 D: 25761 And long TC LLR: 2.96 (-2.94,2.94) Total: 61348 W: 11618 L: 11192 D: 38538 bench: 3787694 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index a73910a7..b33d2e97 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -826,7 +826,6 @@ Value do_evaluate(const Position& pos, Value& margin) { if (pos.is_empty(blockSq)) { squaresToQueen = forward_bb(Us, s); - defendedSquares = squaresToQueen & ei.attackedBy[Us][ALL_PIECES]; // If there is an enemy rook or queen attacking the pawn from behind, // add all X-ray attacks by the rook or queen. Otherwise consider only @@ -837,6 +836,12 @@ Value do_evaluate(const Position& pos, Value& margin) { else unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them)); + if ( unlikely(forward_bb(Them, s) & pos.pieces(Us, ROOK, QUEEN)) + && (forward_bb(Them, s) & pos.pieces(Us, ROOK, QUEEN) & pos.attacks_from(s))) + defendedSquares = squaresToQueen; + else + defendedSquares = squaresToQueen & ei.attackedBy[Us][ALL_PIECES]; + // If there aren't enemy attacks huge bonus, a bit smaller if at // least block square is not attacked, otherwise smallest bonus. int k = !unsafeSquares ? 15 : !(unsafeSquares & blockSq) ? 9 : 3;