This article does not cite any sources. (January 2008) (Learn how and when to remove this template message)
X-FEN is an extension of Forsyth-Edwards Notation (FEN).
The traditional Forsyth-Edwards Notation is not sufficient to represent all possible positions in 8×8 Chess960 (aka Fischer Random Chess) or 10×8 Capablanca Random Chess (CRC). Consequently, an extension of FEN was needed, with the requirement of being fully backward compatible. X-FEN (formerly FRC-FEN), introduced by Reinhard Scharnagl in 2003, accomplishes this.
X-FEN is based on traditional FEN. It differs only in the way that castling and en passant tags are used. Moreover, 10×8 positions which use princess (knight+bishop) and empress (knight+rook) compound pieces are supported.
X-FEN inside of PGN
Games are translated into PGN format (Portable Game Notation). Each game's starting position must be stored in the PGN for Chess960 and Capablanca Random Chess(CRC) (but not for traditional chess). Storing the starting position is accomplished with a SetUp tag and an FEN string using the definitions for traditional chess games.
The specification of an en passant target differs slightly from standard Forsyth-Edwards Notation. FEN records the en passant square field as the square just behind a pawn that has made a two-square push forward in the latest move. As such, whenever a pawn makes a two-square move, the "en passant" square is recorded. From the sample game given in Forsyth-Edwards Notation, we see that FEN includes the square e3 as an en passant square after White makes the first move of the game 1. e4. This is somewhat misleading, as no en passant captures can be made by Black from the position.
X-FEN, on the other hand, includes only true en passant squares. That is, X-FEN records a value in the field for an en passant square only if there are one or more enemy pawns on the same rank on an adjacent file. Thus, after 1.e4, the field for the en passant square is left blank, as Black cannot make an en passant capture. However, it is possible that even if an X-FEN records an en passant square, making that capture would be illegal, because after the capture the king of the capturing player would be in check.
Encoding castling rights
Castling tags "KkQq" are used as known from FEN. As usual lower case letters indicate castling rights for Black, and uppercase letters those for White. "Kk" identifies the ability of g-castling (or i-castling in 10×8 Chess), and "Qq" indicates c-castling. The new and crucial point of the arrangement is that the castling rights provided by this as default are related to the outermost Rook of the affected side. If instead an inner Rook is associated with that right, the traditional castling tag will be replaced by the file letter of the involved Rook, using upper case for White.
Usually the King's castling target is either two squares away from the left (white) border or one square from the right border. But there are also variants having symmetrically distributed target squares (e.g. Janus Chess), both a single field distant each. Then an additional "s" has to precede the castling tokens. Another prefix "m" means: modern castling (e.g. Embassy Chess or Chess480). Here the King will move a regular castling distance (8×8: two steps, 10×8: three steps) aside, but at most just before the border.
Ten consecutive free squares in a rank are encoded by "10", and nine free squares are represented with a "9". For a princess (knight+bishop) the letter "A" is used, after its name in Capablanca Chess (the archbishop); an empress (knight+rook) is encoded using the letter "C" (as it is called the chancellor in Capablanca chess). As usual, lowercase letters are used for black pieces.
The starting position of traditional chess and moreover all of the 18 Pseudo FRC starting position arrays (with castling enabled Rooks and Kings situated in their traditional places) and positions resulting from those entirely will be identically encoded by X-FEN just as usual. Thus X-FEN is fully downwards compatible with traditional FEN.
To use only traditional chess games from within a PGN file (a problem present since Shuffle chess), simply select only PGN entries that do not include any FEN tags.
Castling Right inner Rook before 11. O-O
X-FEN = rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR w Gkq - 4 11
[Event "SmirfGUI Computerchess Game"] [Site "CHESSBOX"] [Date "2005.06.19"] [Time "10:22:29"] [Round "Test"] [White "White"] [Black "Black"] [Result "*"] [Annotator "R. Scharnagl"] [SetUp "1"] [FEN "rnbnkqrb/pppppppp/8/8/8/8/PPPPPPPP/RNBNKQRB w KQkq - 0 1"] 1. h4 g6 2. g3 Bf6 3. a4 Qh6 4. Ra3 Bxh4 5. gxh4 Qxh4 6. Qh3 Qxh3 7. Rxh3 Ne6 8. Bf3 d6 9. Nbc3 Ng5 10. Rhh1 Bf5 11. O-O *