Computer Chess Club Archives




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

Author: Richard A. Fowell (

Date: 11:03:11 02/27/00

Go up one level in this thread

On February 27, 2000 at 11:19:04, Daniel Clausen wrote:

>On February 27, 2000 at 00:15:14, Richard A. Fowell ( wrote:
>>I noticed today that six of the seven chess programs that I tried
>>(three freeware, four commercial) failed to pass the two tests below.
>>(my congratulations to Will Bryant, who programmed Screamer right!)
>>The others don't understand how castling rights and en passant capture
>>rights effect the ability to claim draw by three-fold repetition of position.
>>The FIDE Laws of Chess (1997, but unchanged from when I learned chess 26 years
>>ago) say:
>>#1 Check for knowledge of castling rights on triple repetition draw =
>>1. Nf3 Nf6
>>2. Rg1 Rg8
>>3. Rh1 Rh8   (second occurrence of this visible piece pattern, but first
>>occurrence w/o castling rights)
>>4. Rg1 Rg8
>>5. Rh1 Rh8 ( No draw, yet - this is the original piece pattern, but there
>>             both sides had castling rights. To put it another way, the EPD
>>             strings for the starting position and this one are different.)
>>6. Rg1 Rg8 - draw by triple repetition of position.
>>#2 Check for knowledge of en passant opportunity of triple repetition draw =
>>1.  a4  a6
>>2.  a5  b4 [ This should be b5, as sargon points out. - Richard ]
>>3. Nf3 Nf6
>>4. Ng1 Ng8 (second occurrence of this visible piece pattern, but first
>>occurrence w/o en passant capture option)
>>5. Nf3 Nf6
>>6. Ng1 Ng8 (again, no draw yet - there is no en passant capture possible here,
>>            as there was after Black's second move).
>>7. Nf3 - draw by triple repetition of position.
>>Which chess programs (other than Screamer) get these right?
>Not that anyone cares, but my engine gets these right. :)

Actually, I care - for two reasons. First, it is nice to think that I'm
not the only one to think it is worth doing this right. Second, it might
help other programmers address this if those who do handle this could
present a simple way of doing so.

So - what do you use? Robert Hyatt says he includes castling rights/en passant
in his hash. Is that what you do?

>But only
>if blacks 2nd move in the 2nd mini-game is b5. (instead of b4)

 Quite right - too many years of descriptive notation for me, I fear.
>Kind regards,
> -sargon

This page took 0.02 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.