En passant

From Chessprogramming wiki
Jump to: navigation, search

Home * Chess * Moves * En passant

En passant (from French: "in passing") [1] is a special pawn capture move, which is only possible immediately after an opposing pawn tried passing an advanced pawn on the fifth rank (or fourth for black pawns) by a double pawn push. This double pushed pawn can then be captured the same way, as it would only performed a single push - but only as an immediate reply.

This chess rule makes chess programming a bit harder. First, the target square of the en passant capture is not identical with origin of the captured pawn, opposed to all other captures. Second, the double pawn push, which triggered the immediate possibility of an en passant capture, must be part of the chess position. The information required is whether there was a previous pawn push, and if so, at least the file number of that pawn, considered as en passant target square inside the Forsyth-Edwards Notation (FEN), albeit with the redundant rank (3 or 6) as well.

Legality Test

To prove an en passant capture is actually possible, at least the en passant target square should be under attack of an opponent pawn for pseudo legality. Further, for strict legality, the ep capturing pawn should not be absolutely pinned, which additionally requires a horizontal pin test of both involved pawns, which disappear from the same rank.

    
    
    
    
    
    
    
    
        
      
        
        
    
       
       
       
        
      ♝♝
        
        
♖ ♟♙  ♚ 
    ♙   
♙       
♔       
8/6bb/8/8/R1pP2k1/4P3/P7/K7 b - d3 after d2-d4

The legality test should be best applied in making of the double pawn push, also considering updating Zobist keys to avoid dissimilarity of otherwise repeated positions if the first occurrence happened after a double pawn push with no en passant capture actually possible [2] .

En passant bugs

The implementation of the en passant rule often caused subtle bugs. Almost every chess programmer had various issues with it [3] , most notable Louis Kessler with his Program Brute Force. Gerd Isenberg had a special en passant experience with IsiChess at Aegon 1994 in the game versus Henk Arnoldus. IsiChess pushed its white pawn from b2 to b4 "between" the two advanced pawns a4 and c4 from Henk, allowing two possible en passant options. Unfortunately IsiChess only generated one - the "wrong" one (an assembly bug due to jc instead if jnz or that like, otherwise it would not have played it), and was immediately lost after Henk played the "right" one [4] [5] :

[Event "9th AEGON man-comp"]
[Site "The Hague NED"]
[Date "1994.05.02"]
[Round "4"]
[White "IsiChess"]
[Black "Henk Arnoldus"]
[Result "0-1"]

1.e4 e6 2.d4 d5 3.Nd2 Nf6 4.e5 Nfd7 5.Bd3 b6 6.Ngf3 Ba6 7.O-O Bxd3
8.cxd3 Be7 9.Nb3 O-O 10.Bd2 Na6 11.Qe2 Qc8 12.Rac1 Qb7 13.Rc2 c5
14.Rfc1 Rfc8 15.dxc5 bxc5 16.Qe3 Nb4 17.Bxb4 Qxb4 18.Nbd2 a5 19.a3 Qb7
20.Kh1 Ra6 21.d4 c4 22.Qc3 a4 23.b4 axb3 24.Nxb3 Rxa3 25.Nfd2 Rb8
26.Rb1 cxb3 27.Rcb2 Bb4 28.Qc1 Bxd2 29.Rxd2 Ra2 30.Rdb2 Rxb2
31.Qxb2 Qb4 32.f4 g6 33.h3 Qc4 34.Rc1 Qd3 35.f5 Qxf5 0-1
    
    
    
    
    
    
    
    
      
  
      
      
    
     
   
      
  ♜   ♚ 
 ♛ ♞♝♟♟♟
♜   ♟   
   ♟♙   
♟♙♟♙    
♙ ♕  ♘  
  ♖♘ ♙♙♙
  ♖    ♔
2r3k1/1q1nbppp/r3p3/3pP3/pPpP4/P1Q2N2/2RN1PPP/2R4K b - b3 0 23

See also

Forum Posts

1999

2000 ...

2005 ...

2010 ...

2015 ...

2020 ...

External Links

References

Up one Level