Computer Chess Club Archives




Subject: Does your program understand castling/en passant rights on 3x repetition

Author: Richard A. Fowell (

Date: 21:15:14 02/26/00

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:

9.2. The game is drawn, upon a correct claim by the player having the move, when
the same position, for at least the third time (not necessarily by repetition of

       (a) is about to appear, if he first writes his move on his scoresheet and
declares to the arbiter his intention to make this move, or

       (b) has just appeared.

       Positions as in (a) and (b) are considered the same, if the same player
has the move, pieces of the same kind and colour occupy the same squares, and
       the possible moves of all the pieces of both players are the same.
Positions are not the same if a pawn could have been captured en passant or if
theright to castle immediately or in the future has been changed.

The part programmers seem to have difficulty with is that last sentence.

This citation is from the Malta Chess Federation site:

Try these two games out on your program.
A draw cannot be claimed in either sequence, due to that last
sentence (and, again - it isn't new).

#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
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.

This can be done properly, by keeping track of the
castling rights and en passant situation.

Which chess programs (other than Screamer) get these right?

Richard A. Fowell (

P.S.: Of course, programs (or humans) don't HAVE to claim the draw.
      But, for programs that do, they can't claim it

P.P.S: Screamer is a freeware Macintosh program at:

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