Variant Chess in FENipulator

Thu 2012.01.12
by brian hefele

FENipulator 1.5-1.7 have been released, and they are all about chess variants. The full changelog reveals all the saucy details, but I’ll point out the big ones here. First, in order to accommodate certain chess variants, two fairy pieces have been added to the unicode and simple piecesets — the archbishop and the chancellor. They correspond to FEN a and c, and are represented as such in the simple set. In the unicode set, the archbishop is a bishop rotated 90º, and the chancellor a rook rotated 90º. Additionally, my friend and sometimes design partner Alex Coblentz has illustrated six or seven new piecesets which I am slowly building into files and adding as time permits. They’re pretty awesome, and I’m pretty excited about them.


960 (Fischer Random) Chess

The first variant to make its way into FENipulator is 960 chess. 960 is a randomized opening, adhering to certain rules — home ranks match between players, bishops are counter-color, king is always between rooks. Castling in 960 is as in orthodox chess (that is, the file the king and rook end up on are the same as in orthodox), which meant a major rewrite of the castling code. New functions were thrown in to determine where the king sits on the board — this is necessary to determine if a rook is a- or h-side. A king must also be able to move onto himself now, because castling in 960 can mean the king (or the rook) never moves.


Large Boards (and Small Boards)

Previous to v1.6, boards were largely hardcoded to be 8×8. Presentation of a smaller board may have been possible, but moving sure wasn’t. Larger boards were out of the question. The board is now entirely flexible, allowing board sizes from 1×1 to 26×26. Theoretically, the code will allow for board size up to 99×99, but files start outputting character codes that confuse it right now — best to stick to only an alphabet’s worth. Several shortcuts have been programmed in for large board variants — submitting ‘gothic,’ ‘embassy,’ ‘capablanca,’ or ‘grand’ for FEN results in the opening boards for the respective games. Unfortunately no custom castling rules have been implemented yet — I’m unsure how castling works in Gothic and Capablanca chess, and Embassy chess will require custom rules. If all three are the same, one rule can exist for a 10-wide board, otherwise I’m not sure how I’ll handle it. In the meantime, castling can be achieved manually by resetting the turn value in FEN and performing two moves. Grand chess doesn’t allow castling, so there is no issue there.


Alice Chess (and Ms. Alice Chess)

Version 1.7 brings a rather fun variant, Alice Chess, playable at fenipulator.brhfl.com/alice.php. Alice is played on two boards, with every move transferring to the opposite board. Every move must be legal on the board it’s played on, and every destination space must be empty on the opposite board. This condition is not yet checked for validity, but probably will be in the future (can be a hassle to keep track of manually). A straight drop (or zero move) is possible (for the variant Ms. Alice Chess) by picking a piece to move, and then clicking it again as the destination. All moves on FENipulator Alice should be done on the same board — then FENipulator Alice handles the transfer. Two shortcuts to common variants are available here as well, by entering ‘small’ or ‘opposite’ into the FEN box. Small is a variant playable on a single board (though FENipulator Alice presents it as two half-boards), and opposite is a variant where black and white start on opposite boards.Since FENipulator works exclusively by manipulating FEN data, a specialized FEN must be used to track two boards. Since I’ve not seen an official solution to this, FENipulator separates both boards with a pipe (|), resulting in a starting FEN board representation of rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR|8/8/8/8/8/8/8/8. There are mixed beliefs bout castling and en passant in Alice, and for now, for the sake of getting the code working at all, neither are possible in FENipulator Alice.

Next up in the short-term are the aforementioned validity checks for Alice, castling and en passant in Alice, and castling on large boards. Also, for the sake of chess problems, &c. a third turn state will be added, allowing universal movement. Shortcuts will be added for orthodox, 960, and Alice, and a page outlining all variant shortcuts will be made. Board flipping is going to be moved to the Options page, with options for always, white, black, and never. After these changes, code needs to be cleaned up, and a core file should be made for code shared between standard and Alice FENipulator. This will help in the future if other board variants are necessary (Omega, for instance).