]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
SEE: add support for enpassant moves
[stockfish] / src / position.cpp
index c24d5675d8c1dadbb1de958a5fdd65c276a02be7..5e1ebfeb486880de58081900499f67cd2b4f55b3 100644 (file)
@@ -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);