From: Marco Costalba Date: Sun, 21 Dec 2008 07:29:46 +0000 (+0100) Subject: SEE: add support for enpassant moves X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=72ca727b382212705d2a31588d03eb0c85abddba SEE: add support for enpassant moves Signed-off-by: Marco Costalba --- diff --git a/src/position.cpp b/src/position.cpp index c24d5675..5e1ebfeb 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1626,6 +1626,21 @@ int Position::see(Square from, Square to) const { // Find all attackers to the destination square, with the moving piece // removed, but possibly an X-ray attacker added behind it. occ = occupied_squares(); + + // Handle enpassant moves + if (ep_square() == to && type_of_piece_on(from) == PAWN) + { + assert(capture == EMPTY); + + Square capQq = (side_to_move() == WHITE)? (to - DELTA_N) : (to - DELTA_S); + capture = piece_on(capQq); + + assert(type_of_piece_on(capQq) == PAWN); + + // Remove the captured pawn + clear_bit(&occ, capQq); + } + while (true) { clear_bit(&occ, from); diff --git a/src/search.cpp b/src/search.cpp index d89779f8..4712172d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -2284,7 +2284,8 @@ namespace { if ( !PruneBlockingMoves && threat != MOVE_NONE && piece_is_slider(pos.piece_on(tfrom)) - && bit_is_set(squares_between(tfrom, tto), mto) && pos.see(m) >= 0) + && bit_is_set(squares_between(tfrom, tto), mto) + && pos.see(m) >= 0) return false; return true;