Fix x-ray attack from behind in evaluate_passed_pawns()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 11 Oct 2009 16:30:35 +0000 (18:30 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 12 Oct 2009 07:36:35 +0000 (09:36 +0200)
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 <mcostalba@gmail.com>
src/evaluate.cpp

index 9cf33b1535a2c8d25d2435295e6301fcf9e62aa3..9007e9c78a1d73e642e89e2ee07c90487fbc7f30 100644 (file)
@@ -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 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?
                     b3 = b2;
 
                 // Are any of the squares in the pawn's path attacked or occupied by the enemy?