Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fix x-ray attack from behind in evaluate_passed_pawns()

Fix a condition for x-ray attack of a queen or
a rook behind a pawn of us. Previous condition does
not check if the enemy slider behind our pawn is
really attacking the pawn.

Signed-off-by: Marco Costalba <>
  • Loading branch information...
commit 2655f93c322c69c9ad85bd4be69d545c05e9260a 1 parent ab4d26f
@mcostalba authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/evaluate.cpp
4 src/evaluate.cpp
@@ -940,8 +940,8 @@ namespace {
// If there is an enemy rook or queen attacking the pawn from behind,
// add all X-ray attacks by the rook or queen.
- if ( bit_is_set(ei.attacked_by(Them, ROOK) | ei.attacked_by(Them, QUEEN), s)
- && (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them)))
+ if ( (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them))
+ && (squares_behind(Us, s) & pos.pieces(ROOK, QUEEN, Them) & pos.attacks_from<QUEEN>(s)))
b3 = b2;
// Are any of the squares in the pawn's path attacked or occupied by the enemy?
Please sign in to comment.
Something went wrong with that request. Please try again.