Forsyth–Edwards Notation
Forsyth–Edwards Notation
- Forsyth–Edwards Notation (FEN**) is a standard notation for describing a particular board position of a [[chess]] game. The purpose of FEN is to provide all the necessary information to restart a game from a particular position.
History ### Forsyth notation FEN is based on a system known as Forsyth notation, developed in 1883 by Scottish newspaper journalist David Forsyth. His system became popular in the 19th century. Unlike modern FEN, this notation, designed as a short-hand for writing out the position of every piece on the board, was only interested in capturing the position of the pieces, and not the other metadata such as which player is to move, castling availability, and move count, which presumably would have been written out in full or implied by context.
The notation was first proposed by Forsyth in the Glasgow Weekly Herald on February 2, 1883. Forsyth wrote:
Forsyth's original system used one line of written text for each rank of the board. Each piece was denoted by a letter or letters: K, Q, R, B, P, with the knight being denoted with "Kt", which was the convention at the time. Black pieces were denoted with an underline. Empty squares were denoted with a "0", with a series of adjacent empty squares being denoted with that number (e.g. "5" denoted a sequence of five empty squares on a row). Oddly, this meant that one would use "0" for one square and "2" for two squares, with no use for the digit "1".
Forsyth gives an example (with the accompanying text "after Black's 40th move"):
denoting a position with a black rook on b8, two black pawns on f7 and g7, white rooks on a6 and d6 and a black pawn on h6, and so on. The equivalent position in modern FEN is:
<pre> 1r6/5pp1/R1R4p/1r1pP3/2pkQPP1/7P/1P6/2K5 w - - 0 41 </pre>
By 1897, the notation appears to have evolved to more resemble the modern syntax, with the following example given in a biography of Forsyth in The Chess Bouquet:
In this version, the position is written all on one line, with commas to separate ranks, the "0" denoting a single empty square has been replaced with a "1", and black pieces are denoted with lowercase letters rather than underlines. The equivalent position in modern FEN is:
<pre> 1B6/2n5/p1N1P2R/P1K3N1/4Pk2/1Q2p2p/6nP/1B4R1 w - - 0 1 </pre>
Extension by Edwards In 1993, Steven J. Edwards extended Forsyth's system to support its use by computers, as part of the Portable Game Notation standard. The most commonly cited version was published on March 12, 1994}}
- Piece placement data: Each is described, starting with rank 8 and ending with rank 1, with a "/" between each one; within each rank, the contents of the squares are described in order from the a- to the h-file. Each piece is identified by a single letter taken from the standard English names in algebraic notation (pawn = "P", knight = "N", bishop = "B", rook = "R", queen = "Q", and king = "K"). White pieces are designated using uppercase letters ("PNBRQK"), while black pieces use lowercase letters ("pnbrqk"). A set of one or more consecutive empty squares within a rank is denoted by a digit from "1" to "8", corresponding to the number of squares.
- Active color: "w" means that White is to move; "b" means that Black is to move.
- Castling availability: If neither side has the ability to castle, this field uses the character "-". Otherwise, this field contains one or more letters: "K" if White can castle kingside, "Q" if White can castle queenside, "k" if Black can castle kingside, and "q" if Black can castle queenside. A situation that temporarily prevents castling does not prevent the use of this notation.
- En passant target square: This is a square over which a pawn has just passed while moving two squares; it is given in algebraic notation. If there is no en passant target square, this field uses the character "-". This is recorded regardless of whether there is a pawn in position to capture en passant.{{refn|Section "16.2.3.4: En passant target square" in "Portable Game Notation Specification and Implementation Guide"
- Halfmove clock: The number of halfmoves since the last capture or pawn advance, used for the fifty-move rule.{{refn|Section "16.1.3.5: Halfmove clock" states "This value is used for the fifty move draw rule."
For the traditional setup, Shredder-FEN would use AHah instead of KQkq.
Another solution is offered by x-fen, which offers more backward compatibility than Shredder-FEN does, but at the cost of more complexity.