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.
FEN is based on a system developed by
Definition
A FEN record defines a particular game position, all in one text line and using only the ASCII character set. A text file with only FEN data records should use the filename extension .fen
.[4]
A FEN record contains six fields, each separated by a space. The fields are as follows:[5]
- Piece placement data: Each rank 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-file 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.[6] An updated version of the spec has since made it so the target square is recorded only if a legal en passant capture is possible, but the old version of the standard is the one most commonly used.[7][8]
- Halfmove clock: The number of halfmoves since the last capture or pawn advance, used for the fifty-move rule.[9]
- Fullmove number: The number of the full moves. It starts at 1 and is incremented after Black's move.
Examples
The following example is from the FEN specification:[10]
Here is the FEN for the starting position:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
And after the move 1.e4:
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
And then after 1...c5:
rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2
And then after 2.Nf3:
rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
FEN adjustment for chess variants like Chess960
FEN is crucial for recording games in chess variants such as
Another solution is offered by X-FEN, which offers more backward compatibility than Shredder-FEN does, but at the cost of more complexity.
See also
References
- ^ a b c d e f g h "Standard: Portable Game Notation Specification and Implementation Guide". Internet Archive. 12 March 1994. Retrieved 25 July 2020. The page linking to the document is here.
- ^ Section "16.1: FEN" in "Portable Game Notation Specification and Implementation Guide"[1]
- ^ Sections "9.7.1: Tag: SetUp" and "9.7.2: Tag: FEN" in "Portable Game Notation Specification and Implementation Guide"[1]
- ^ Last paragraph in section "16.1: FEN" in "Portable Game Notation Specification and Implementation Guide"[1]
- ^ Sections 16.1.3.1 to 16.1.3.6: in "Portable Game Notation Specification and Implementation Guide"[1]
- ^ Section "16.2.3.4: En passant target square" in "Portable Game Notation Specification and Implementation Guide"[1]
- ^ "About that en passant target square". TalkChess.com. September 16, 2014. Archived from the original on 2022-07-02.
- ^ "Portable Game Notation Specification and Implementation Guide". GitHub. 2020-06-03. Archived from the original on 2022-07-02.
- ^ Section "16.1.3.5: Halfmove clock" states "This value is used for the fifty move draw rule."[1]
- ^ Section "16.1.4: Examples" in "Portable Game Notation Specification and Implementation Guide"[1]
- ^ "Shredder-FEN". www.chessprogramming.org. April 5, 2022.