Page 1 of 1

Variants and Board Size

Posted: Thu Oct 25, 2007 7:48 pm
by hgm
I would like to hear some opinions on how to handle the matter of variant names in the Winboard protocol.

The variants that are mentioned in the current description of the protocol are variations to the rules that the GUI has to be aware of in performing the moves passed to it on the display. This in particular applies to castling, and the possibility of piece drops for bughouse / crazyhouse.

Basically a variant is characterized by 3 traits:
1) board size
2) opening position piece placement
3) rules for moving pieces

So far board size could not be varied, and opening position would either be standard FIDE, or not uniquely determined by the variant (in the various shuffle games). So the 'new' command could always set up the FIDE position, and if the game was a shuffle variant, the GUI would have to tell the engine the opening position through a FEN or the edit menu. The variant thus only pertained to the rules of movement (making sure e.p.-captured Pawns disappear, the Rook moves on castling, which castlings are allowed, and annotating PGN files with check and checkmate indicators). This is why, according to protocol, the 'variant <name>' command is sent after the 'new' command.

Now other board sizes are supported, this becomes a bit cumbersome. An engine receiving a 'new' command does not know yet if it will be playing FIDE or 10x8 Capablanca Chess, so how can it set up the initial position?

Are there any ideas how to solve this best?

There are no commands defined in the protocol (yet) for communicating board size to the engine. The variant command could be used for this, if a variant would always imply the board size.

On the other hand, it would be convenient to have the variant only relate to point (3), to have orthogonal choice of rules and board size. Why not play shuffle chess on a 10x8 board, for instance (CRC?)? Or Capablanca Suicide, Capablanca Atomic, Capablanca Bughouse. And why not play it on a 12x8 board, with two Archbishops and two Chancellors per side? Variant="capablanca" could be taken only to mean that A and C are legal pieces known by the interface, that you can also promote to.

Similarly, variant="courier" could be taken to mean that pieces like Elephants, Commoners and Wazirs can participate (and thattheir moves are known), that the Queen is actually a Ferz, and that Pawns (always promoting to Ferz) have no double move. This would cover both Shatranj (on 8x8) and Courier Chess (on 12x8).

Would it be a good idea to use the 'variant' command as a more specific 'new', i.e. as soon as the GUI receives it, it starts a new game (now knowing which one) by resetting the engine(s)? There seems not much point in changing variant on a game that is in progress.

This would mean the 'variant' command should imply the board size and opening array. But this either strongly limits what you can do, or gives an impossibly large number of variant names.

How about allowing variant names with parameters? Say that variant names starting with NxM, with N and M numbers, are interpreted as setting the board size to N files and M ranks, and then using whatever string that follows as a name describing the rules. So "8x8capablanca" would be a game on a normal board, but allowing Archbishop and Chancellor to participate. Just "capablanca" would be short for "10x8capablanca". The GUI would know this, and would also know the opening position, and would assume that the engine knows it too.

Very few variants would have an opening array know to the GUI, but in other cases the opening array could default to a standard position determined by the board width (Los-Alamos, FIDE, Capablanca or Courier for 6, 8, 10 or 12), compatible with the chosen rules. Boards of other sizes would simply start empty, awaiting a 'setboard' or 'edit' command. So 10x8normal would start with an empty board (as the Capablanca array is incompatible with FIDE rules due to presence of A and C).

Does this sound like a workable solution for users and engine builders?