Check out Grant Acedrex, our featured variant for April, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Chess. Play Chess online with other people, using Game Courier, a PBM system that works with any web browser on any computer.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Fri, Apr 27, 2012 04:31 PM UTC:

I have just added support for the three-times repetition rule in Chess. When a player creates the same board position for the third time, and all the same moves are available, as in castling and en passant conditions are the same, then the game ends in a draw.

Here is how it is done. At the end of each post-move section, a variable representing the current state of the game is incremented, using code like this:

set posvar join "w" join fencode boardflags;
inc #posvar;

In the post-game section, the variable name for the current state of the board is computed, and its value is compared with 3, using code like this:

set posvar join "w" join fencode boardflags;
if >= var #posvar 3:
  say Three Times Repetition! Drawn Game!;
  drawn;
endif;

The code I've shown is for White. For Black, substitute "b" for "w".

I wrote the boardflags operator today. It returns an ordered string of all the flags that are turned on and whose names match coordinate positions. The variable posvar gets set to a long string that will be used as a variable name. #posvar returns the value of posvar, and var #posvar returns the value of the variable whose name is stored in the variable posvar.