X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=5e1ebfeb486880de58081900499f67cd2b4f55b3;hp=c24d5675d8c1dadbb1de958a5fdd65c276a02be7;hb=e46d3670fd1d5925bd241dec37b84097d2884707;hpb=aaad48464bc8a269634de371238826d09a6e240d 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);