# Fairy Forsythe Edwards Notation

This document describes an extension of the well known Forsythe Notation for describing setups on a chessboard - that notation is also known as the Forsythe Edwards Notation. This extension, called Fairy Forsythe Edwards Notation, abbreviated as FFEN, is meant to describe setups on a chessboard, possibly of different sizes and shapes, and possibly with non-standard chess pieces.

The FFEN was proposed in March 1998 by Hans Bodlaender, and used in a tool to for publishing fairy chess diagrams programmed by Andy Kurnia.

This document describes FFEN version 0.02.

## Limitations

The current form of the FFEN can only be used to describe diagrams for (one- or) two-dimensional chess variants, with pieces standing on squares. All fields should be equally sized squares or rectangles. In particular, this means that the current version of the FFEN is not meant to describe setups for three-dimensional chess variants, for variants on hexagonal or circular boards, and for games like Xiangqi where pieces stand on intersection lines.

Also, a shorthand notation for multiple empty lines used in the FEN is not available. In FEN, one could e.g. describe three successive empty rows (of eight squares each) as /24/; in the FFEN one should write /8/8/8/. (See for details below.)

## Extensions to FEN

FFEN has a number of extensions to the FEN. It is possible to describe setups on boards of a size different from 8 by 8, to describe boards where not all squares are present, to use pieces different from king, queen, rook, knight, bishop, or pawn, and to use pieces (standard or non-standard) of colors different from white and black.

## Description of the FFEN

The FFEN is a description of a setup of chess or fairy chess pieces on a board made of squares, arranged as a subset of squares in a grid.

The setup is described row by row, starting at the upper row, i.e. the first row at Black's side, which is the last row seen from White's side. Each row description is separated by a slash (/) symbol.

A row description gives the contents of a row from left to right, seen from White's side. The contents of the squares are given successively, with consecutive empty squares described together.

The following row description elements exist:

• Single symbols from the alphabet. A symbol from the alphabet, either lower case or upper case, can be used to denote that the square contains a piece. Upper case symbols correspond with white pieces; lower case symbols with black pieces. K and k stand for white and black kings; Q and q for queens; R and r for rooks; N and n for knights; B and b for bishops; P and p for pawns. The other characters from the alphabet can be used to describe fairy pieces.
• Empty squares are denoted by (positive) integers. An integer denotes that number of successive squares on the row that do not contain a piece. If two or more digits follow, then these are read by an integer. For example, K12k gives a row with first a white king, then twelve empty squares, and then a black king. Integers that start with a zero should not be used.
• Non-existing squares are denoted by a hyphen (-). For example, an empty board that is obtained by removing the upper right and lower left corner of an eight by eight chess board is denoted as 7-/8/8/8/8/8/8/-7. If we would play on a chessboard where the four center squares do not exist, then one for the opening setup is: rnbqkbnr/pppppppp/8/3--3/3--3/PPPPPPPP/RNBQKBNR.
• Non-standard pieces can also be described by a longer description, consisting of more than one character. Such a description is placed between brackets. There are two forms:
• All characters of the description are alphabetic. For instance (Nightrider) or (grasshopper). These denote white or black fairy pieces. The whole sequence starting with the ( and ending with the ) describes one fairy piece. The first character determines whether it is a white or a black piece: if upper case, the description denotes a white piece; if lower case, the description denotes a black piece. Brackets around a single character are ignored.
• The string between bracket starts with one or more alphabetic characters, followed by one or more digits. These are provided for different colored pieces or non-standard squares. (name0) and (name1) have the same effect as respectively (Name) and (name), respectively, i.e. 0 denotes a white piece, 1 denotes a black piece. The following conventions are used further:
• 2: Neutral piece.
• 3, 4, 5, 6: different colored pieces.

Except for the first character, cases of the other alphabetic characters in these strings are ignored.

### Options

At the start of the FFEN-string, options can be added. The current version of FFEN supports the following options:

• W: The board is checkered, and a white square is in the lower left corner.
• U: The board is uncheckered.

If neither the W or U option is in effect, the board is checkered with a black square in the lower left corner.

## Examples

• rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR is the setup of standard chess.
• {U}rn(elephant)k(general)(elephant)nr/pppppppp/8/8/8/8/RN(Elephant)K(General)(Elephant)NR gives the setup for Shatranj.
• {W}8/8/8/8/8 gives a 5 by 8 board with a white square in the lower left corner.

# FFEN-to-HTML

FFEN-to-HTML is a tool that helps to make html-code that displays a (fairy) chess setup, given in FFEN. It can be used in collection with a set of gif-files (or picture files in other formats supported by browsers, like jpeg); each giving a single square of a (fairy or standard) chess board with possibly a (fairy or standard) chess piece on it.

The program runs under 32-bit Windows. You need file: VB40032.DLL. You can download this file from elsewhere on the WWW. Put this file in the c:/windows/system folder.

This tool is Freeware. Copyright rests by Andy Kurnia, but you may use it without fee. That, of course, also implies that you have no right to any support of any kind. Use it as it is, and at your own risk, although no bugs or problems are known to us. Comments are welcome, and could be send to Andy Kurnia or Hans Bodlaender.

The tool gets as input a FFEN-string, and a string that describes how the conversion to HTML should be made. The html-code can be sent to the clipboard, and optionally Notepad can be launched with it.

The following filenames are used:

• A gif for a square with a piece with a one-character alphabetic name like K or k has a filename of the form ABC.gif, where A is the lower case symbol of the piece; B is digit 0 for a white, and digit 1 for a black piece; and C is digit 0 for a white, digit 1 for a black, and digit 2 for an uncolored square. So, a white king on a white square corresponds with filename k00.gif, and a black king on a white square with k10.gif.
• Pieces given with their name in brackets with only alphabetic characters follow a similar convention, with BC.gif as above following the name between brackets in entirely lower case. For example, (GrassHopper) translates to grasshopper00.gif if on a white square and to grasshopper01.gif if on a black square.
• Pieces given with their name in brackets with digits are converted by setting all alphabetic characters in digits, and following the digits from the name by one digit determining the color of the square, i.e., (StringDigits) goes to stringdigitsC.gif, C as above.
• x0.gif gives a white empty square; x1.gif gives a black empty square.
• A non existing square ( given as - ) corresponds with filename x.gif.

## Detailed description

You'll get a dialog box like the one below:

[ ]: The system menu (the control menu). It has "minimize", "move"
as well as "close" (alt+f4).

FFEN: (Alt+F) This should contain your FFEN. Supported are:

{W} --> should be the first 3 chars and should be with uppercase W
{U} --> should be the first 3 chars and should be with uppercase U
P, p --> single-letter pieces (WHITE, black)
12 --> positive integers: number of vacant squares
(Piece), (piece) --> multi-letter pieces; (p) = p; (White, black)
(Piece3), (piece3) --> multi-letter pieces with the B value (the piece
color) determined. In determining this, the LAST char is checked
and should be a digit.
- --> squareless (x.gif)

Syntax: (Alt+S) This defines how a square is translated to.
%% is replaced with a single %
%f is replaced by the proposed filename (no extension!)
%s is replaced by the piece's name (or nothing for - or spaces)
(only %f and %s work, %F and %S do not work)

Notepad: (Alt+N) (Enter) This default button puts the HTML code to the
clipboard, fires up Notepad and presses Shift+Insert there (i.e.
paste the HTML code to the new Notepad window).

Clipboard: (Alt+C) This button puts the HTML code to the clipboard --
that's all.

Exit: (Alt+X) (Esc) (Alt+F4) This button exits the program.

### Implementation Notes

Zero's at the start of an integer are ignored, so 007 has the same effect as 7, and 010 has the same effect as 10.

"%f" = "xC", "%s" = ""

- (hyphen): squareless. "%f" = "x", "%s" = ""

P (or any non-X UPPERCASE letter): white piece (single letter). "%f" = "p0C", "%s" = "P" (C = square color)

p (or any non-x lowercase letter): black piece (single letter). "%f" = "p1C", "%s" = "p"

(xyzabc): white piece --> "%f" = "xyzabc0C", "%s" = "xyzabc"
(xYzAbC): white piece (because it's still lowercase 'x') --> "%f" = "xyzabc0C", "%s" = "xYzAbC"

(Xyzabc): black piece --> "%f" = "xyzabc1C", "%s" = "Xyzabc"
(XYZABC): black piece --> "%f" = "xyzabc1C", "%s" = "XYZABC"

(xyzabc8): "%f" = "xyzabc8C", "%s" = "xyzabc8", etc. (8 can be any number)

(): ignored

(-): these are also x (squareless)!
(p), (P): same as p or P

@: (or any unknown symbol) are considered 0 (vacant square)

(\$fD): 1st char non-uppercase so it's a black piece: "%f" = "\$fd1C", "%s" = "\$fD"

/: translated to <BR>
only <BR>, no extra newline (all the HTML code is on one line)

You must manually check that all rows (separated by /) have the same number of columns.

The number of /'s (as well as the presence or absence of {W}) determine C (square color).

If {U} is used, square color is always 2. If {W} is used, lower-left is 0 (white). Then it's checkered using 1 and 0. Otherwise lower-left is 1 (black). It's checkered using 0 and 1.

## Tips

Use the Syntax: to determine WIDTH=, HEIGHT=, the presence of ALT= (and what it contains), the path (e.g. "../"), the extension (e.g. ".gif"), etc.

Both FFEN: and Syntax: support standard text editing! (All Windows textboxes do.) This includes: Undo/Cut/Copy/Paste with Ctrl+Z/Ctrl+X/Ctrl+C/Ctrl+V, Undo/Cut/Copy/Paste/Delete with Alt+BackSpace/Shift+Del/Ctrl+Ins/Shift+Ins/Del, and Undo/Cut/Copy/Paste/Delete/Select All in the pop-up menu (right-click the textbox, or Shift+F10, or use the MENU key on keyboards designed for Win95).

You can press Esc to exit the program.

Using "Notepad" also copies the HTML code to the clipboard. (You can use File/Save As... in Notepad!)

You can minimize the program. Use the menu you get with Alt+Spacebar (it's the system menu, or control menu).

You can close the program with many ways. These are the ways using the program itself:

• Click 'X' in the top-right corner.
• Push "Exit" (with mouse; normally; Alt+X; Esc)
• Double click the system menu (it's represented by an icon)
• Open the system menu (Alt+Spacebar), choose Close
• Press Alt+F4 (default hotkey for Close)

In addition you can use Ctrl+Alt+Del and push End Task, but that's cruel ;-)

Written by Hans Bodlaender and Andy Kurnia.