]> git.sesse.net Git - stockfish/commitdiff
SEE: add support for enpassant moves
authorMarco Costalba <mcostalba@gmail.com>
Sun, 21 Dec 2008 07:29:46 +0000 (08:29 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 21 Dec 2008 09:44:41 +0000 (10:44 +0100)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp
src/search.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);
index d89779f85bf9eb4fb3c8e8c9e3f3c96056a2dd2c..4712172d5a13bcb23d7aa08e32764e89685aad8c 100644 (file)
@@ -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;