Computer Chess Club Archives




Subject: Re: What approach do you use to handle castling/en passant for repetition?

Author: Dann Corbit

Date: 19:33:18 02/28/00

Go up one level in this thread

On February 28, 2000 at 22:04:05, Robert Hyatt wrote:
>This is what I do.  I have even seen "EPD" records with an en passant target
>set simply because the last move was a double-move for a pawn.  Even though
>no possible EP capture was possible (this used to break my code, in fact, but
>now I screen this out as I set up the position).

As strange as this may sound, that is the correct way to encode the record.
From the PGN standard:

" En passant target square

The fourth field is the en passant target square.  If there is no en passant
target square then the single character symbol "-" appears.  If there is an en
passant target square then is represented by a lowercase file character
immediately followed by a rank digit.  Obviously, the rank digit will be "3"
following a white pawn double advance (Black is the active color) or else be
the digit "6" after a black pawn double advance (White being the active color).

An en passant target square is given if and only if the last move was a pawn
advance of two squares.  Therefore, an en passant target square field may have
a square name even if there is no pawn of the opposing side that may
immediately execute the en passant capture."

Notice the contents of the second paragraph.  Even if the e.p. flag has no
effect, it must be set.  I think this might possibly make sense for move
generation (i.e. you generate the positions without having to check if there is
a pawn in a position to take the pawn which advanced two squares).  On the other
hand, if we visit the board position a large number of times, we may be "money
ahead" to calculate whether there is an effect or not just once.  I think this
issue is being addressed in an update to the PGN standard.  I have suggested an
EPD "storage format" where the flag is present if and only if the pawn can be
captured or it somehow has an effect on play.  It would reduce my work in CAP
quite a bit, since having spurious flags can potentially multiply the number of
board positions and removing the flags would have no effect.

This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.