Difference between revisions of "Forsyth-Edwards Notation"
GerdIsenberg (talk | contribs) m |
GerdIsenberg (talk | contribs) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 20: | Line 20: | ||
The Piece Placement is determined rank by rank in [[Big-endian|big-endian]] order, that is starting at the 8th rank down to the first rank. Each rank is separated by the terminal symbol '/' (slash). One rank, scans piece placement in [[Little-endian|little-endian]] file-order from the A to H. | The Piece Placement is determined rank by rank in [[Big-endian|big-endian]] order, that is starting at the 8th rank down to the first rank. Each rank is separated by the terminal symbol '/' (slash). One rank, scans piece placement in [[Little-endian|little-endian]] file-order from the A to H. | ||
− | A decimal digit counts consecutive empty squares, the pieces are identified by a single letter from standard English names for chess pieces as used in the [[Algebraic | + | A decimal digit counts consecutive empty squares, the pieces are identified by a single letter from standard English names for chess pieces as used in the [[Algebraic Chess Notation]]. Uppercase letters are for white pieces, lowercase letters for black pieces. |
<pre> | <pre> | ||
<Piece Placement> ::= <rank8>'/'<rank7>'/'<rank6>'/'<rank5>'/'<rank4>'/'<rank3>'/'<rank2>'/'<rank1> | <Piece Placement> ::= <rank8>'/'<rank7>'/'<rank6>'/'<rank5>'/'<rank4>'/'<rank3>'/'<rank2>'/'<rank1> | ||
Line 78: | Line 78: | ||
<fentt border="none" style="font-size:16pt">rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R</fentt> 1.e4 c5 2.Nf3 | <fentt border="none" style="font-size:16pt">rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R</fentt> 1.e4 c5 2.Nf3 | ||
rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2 | rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2 | ||
+ | |||
+ | =Chess960= | ||
+ | ==Shredder-FEN== | ||
+ | '''Shredder-FEN''' or '''SMK-FEN''' is an extension of FEN covering [[Chess960]], introduced by [[Shredder]] author [[Stefan Meyer-Kahlen]] (SMK) in 2005. | ||
+ | Shredder-FEN uses different [[Castling Rights|castling right]] characters, that is instead of '''KQkq''', upper case and lower case [[Files|file characters]] of the affected rooks for white and black castling rights, and became a [https://en.wikipedia.org/wiki/De_facto_standard de facto standard] supported by most [[GUI|GUIs]] and [[Protocols|protocols]]. | ||
+ | |||
+ | ==X-FEN== | ||
+ | The earlier [https://en.wikipedia.org/wiki/X-FEN X-FEN] extension was introduced by [[Reinhard Scharnagl]] in 2003, and covers not only [[Chess960]] but also 10x8 variants. Its author dogmatically claimed upward compatibility with standard chess <ref>[https://www.stmintz.com/ccc/index.php?id=437213 Why to use compatible X-FEN (in Chess960)] by [[Reinhard Scharnagl]], [[CCC]], July 17, 2005</ref>, still using the '''KQkq''' [[Castling Rights|castling right]] characters for all Chess960 positions. Further, X-FEN introduced a changed [[En passant|en passant]] target square semantic, which is only specified after a double pawn push was made beside an opponent pawn that might capture en passant if legal, that is not leaving its king in check. | ||
=See also= | =See also= | ||
Line 83: | Line 91: | ||
* [[Forsyth-Edwards Expanded Notation]] (FEEN) | * [[Forsyth-Edwards Expanded Notation]] (FEEN) | ||
* [[Portable Game Notation]] (PGN) | * [[Portable Game Notation]] (PGN) | ||
+ | * [[BMI2#FEN Compression|BMI2 FEN Compression]] | ||
=Forum Posts= | =Forum Posts= | ||
+ | ==1993 ...== | ||
+ | * [https://groups.google.com/d/msg/rec.games.chess/MkLV6dIwGU4/GfbtTyR6o6sJ Revised PGN standard available] by [[Steven Edwards]], [[Computer Chess Forums|rgc]], December 20, 1993 » [[Portable Game Notation]] | ||
+ | * [https://www.stmintz.com/ccc/index.php?id=53266 Full definition for FEN] by [[Dann Corbit]], [[CCC]], May 27, 1999 | ||
==2000 ...== | ==2000 ...== | ||
* [https://www.stmintz.com/ccc/index.php?id=138460 File name extensions] by [[Leen Ammeraal]], [[CCC]], November 14, 2000 | * [https://www.stmintz.com/ccc/index.php?id=138460 File name extensions] by [[Leen Ammeraal]], [[CCC]], November 14, 2000 | ||
+ | * [https://www.stmintz.com/ccc/index.php?id=314898 Ten years later: revising EPD/FEN/PGN] by [[Steven Edwards]], [[CCC]], September 09, 2003 | ||
* [https://www.stmintz.com/ccc/index.php?id=323898 Making positions in eps] by [[Jan Renze Steenhuisen|Renze Steenhuisen]], [[CCC]], October 27, 2003 » [[Forsyth-Edwards Notation#FEN2EPS|Fen2eps]] | * [https://www.stmintz.com/ccc/index.php?id=323898 Making positions in eps] by [[Jan Renze Steenhuisen|Renze Steenhuisen]], [[CCC]], October 27, 2003 » [[Forsyth-Edwards Notation#FEN2EPS|Fen2eps]] | ||
==2005 ...== | ==2005 ...== | ||
+ | * [https://www.stmintz.com/ccc/index.php?id=437213 Why to use compatible X-FEN (in Chess960)] by [[Reinhard Scharnagl]], [[CCC]], July 17, 2005 | ||
+ | * [https://www.stmintz.com/ccc/index.php?id=439792 Chess960: X-FEN rules international] by [[Reinhard Scharnagl]], [[CCC]], August 03, 2005 | ||
* [https://www.stmintz.com/ccc/index.php?id=439995 contradicting FEN and SMK-FEN] by [[Reinhard Scharnagl]], [[CCC]], August 04, 2005 | * [https://www.stmintz.com/ccc/index.php?id=439995 contradicting FEN and SMK-FEN] by [[Reinhard Scharnagl]], [[CCC]], August 04, 2005 | ||
+ | * [https://www.stmintz.com/ccc/index.php?id=459898 Chess960: Arena castle vs X-FEN castle] by [[Matthias Gemuh]], [[CCC]], November 05, 2005 | ||
* [http://www.talkchess.com/forum/viewtopic.php?t=13923 fen to fen functions] by [[Uri Blass]], [[CCC]], May 21, 2007 | * [http://www.talkchess.com/forum/viewtopic.php?t=13923 fen to fen functions] by [[Uri Blass]], [[CCC]], May 21, 2007 | ||
==2010 ...== | ==2010 ...== | ||
Line 105: | Line 121: | ||
* [http://www.talkchess.com/forum/viewtopic.php?t=59255 Any tool to convert FEN strings to diagrams?] by Ted Wong, [[CCC]], February 15, 2016 | * [http://www.talkchess.com/forum/viewtopic.php?t=59255 Any tool to convert FEN strings to diagrams?] by Ted Wong, [[CCC]], February 15, 2016 | ||
* [http://www.talkchess.com/forum/viewtopic.php?t=64003 FEN - Flipper for Windows] by [[Matthias Gemuh]], [[CCC]], May 17, 2017 » [[Color Flipping]], [[Extended Position Description|EPD]] | * [http://www.talkchess.com/forum/viewtopic.php?t=64003 FEN - Flipper for Windows] by [[Matthias Gemuh]], [[CCC]], May 17, 2017 » [[Color Flipping]], [[Extended Position Description|EPD]] | ||
− | + | * [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=72308 50 move counter in FEN and GUIs] by [[Jouni Uski]], [[CCC]], November 12, 2019 | |
+ | ==2020 ...== | ||
+ | * [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=73552 FEN and 3rd repetition rule. No information?] by [[Luis Babboni]], [[CCC]], April 03, 2020 » [[Repetitions]] | ||
+ | * [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=76892 FEN compression] by lucasart, [[CCC]], March 17, 2021 » [[BMI2#FEN Compression|FEN Compression]], [[NNUE#Training|NNUE Training]] | ||
+ | * [https://www.talkchess.com/forum3/viewtopic.php?f=7&t=79627 Required fields in Forsyth-Edwards Notation (FEN)] by [[Niels Abildskov]], [[CCC]], April 02, 2022 | ||
+ | |||
=External Links= | =External Links= | ||
* [https://en.wikipedia.org/wiki/Forsyth-Edwards_Notation Forsyth-Edwards Notation from Wikipedia] | * [https://en.wikipedia.org/wiki/Forsyth-Edwards_Notation Forsyth-Edwards Notation from Wikipedia] | ||
Line 113: | Line 134: | ||
: [http://www.gilith.com/software/fen2img/ fen2img Chess Diagram Maker] by [[Joe Leslie-Hurd]] | : [http://www.gilith.com/software/fen2img/ fen2img Chess Diagram Maker] by [[Joe Leslie-Hurd]] | ||
* [http://webchess.freehostia.com/diag/index.php Chess Diagram Generator] | * [http://webchess.freehostia.com/diag/index.php Chess Diagram Generator] | ||
+ | * [https://github.com/bagaturchess/ChessBoardScanner GitHub - bagaturchess/ChessBoardScanner: Java based Chess Board Scanner, which converts 2D chess board image into a machine readable format a.k.a. Forsyth–Edwards Notation (FEN)] by [[Krasimir Topchiyski]] | ||
* [http://chessforeva.blogspot.de/2009/10/3d-chess-diagram-from-fen.html Chessforeva: 3D chess diagram from FEN] » [[3D Graphics Board]] | * [http://chessforeva.blogspot.de/2009/10/3d-chess-diagram-from-fen.html Chessforeva: 3D chess diagram from FEN] » [[3D Graphics Board]] | ||
* <span id="FEN2EPS"></span>[http://fen2eps.sourceforge.net/ Fen2eps] by [[Dirk Baechle]] <ref>[https://en.wikipedia.org/wiki/Encapsulated_PostScript Encapsulated PostScript from Wikipedia]</ref> | * <span id="FEN2EPS"></span>[http://fen2eps.sourceforge.net/ Fen2eps] by [[Dirk Baechle]] <ref>[https://en.wikipedia.org/wiki/Encapsulated_PostScript Encapsulated PostScript from Wikipedia]</ref> |
Latest revision as of 08:47, 5 April 2022
Home * Chess * Position * Forsyth-Edwards Notation
Forsyth-Edwards Notation (FEN) describes a Chess Position. It is an one-line ASCII-string. FEN is based on a system created by Scotsman David Forsyth in the 19th century. Steven Edwards specified the FEN standard for computer chess applications as part of the Portable Game Notation [1] .
FEN Syntax
One FEN string or record consists of six fields separated by a space character. The first four fields of the FEN specification are the same as the first four fields of the EPD specification.
Terminal and nonterminal symbols of a variant of BNF below are embedded in ' ' resp. < >.
<FEN> ::= <Piece Placement> ' ' <Side to move> ' ' <Castling ability> ' ' <En passant target square> ' ' <Halfmove clock> ' ' <Fullmove counter>
Piece Placement
The Piece Placement is determined rank by rank in big-endian order, that is starting at the 8th rank down to the first rank. Each rank is separated by the terminal symbol '/' (slash). One rank, scans piece placement in little-endian file-order from the A to H.
A decimal digit counts consecutive empty squares, the pieces are identified by a single letter from standard English names for chess pieces as used in the Algebraic Chess Notation. Uppercase letters are for white pieces, lowercase letters for black pieces.
<Piece Placement> ::= <rank8>'/'<rank7>'/'<rank6>'/'<rank5>'/'<rank4>'/'<rank3>'/'<rank2>'/'<rank1> <ranki> ::= [<digit17>]<piece> {[<digit17>]<piece>} [<digit17>] | '8' <piece> ::= <white Piece> | <black Piece> <digit17> ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' <white Piece> ::= 'P' | 'N' | 'B' | 'R' | 'Q' | 'K' <black Piece> ::= 'p' | 'n' | 'b' | 'r' | 'q' | 'k'
Side to move
Side to move is one lowercase letter for either White ('w') or Black ('b').
<Side to move> ::= {'w' | 'b'}
Castling ability
If neither side can castle, the symbol '-' is used, otherwise each of four individual castling rights for king and queen castling for both sides are indicated by a sequence of one to four letters.
<Castling ability> ::= '-' | ['K'] ['Q'] ['k'] ['q'] (1..4)
En passant target square
The en passant target square is specified after a double push of a pawn, no matter whether an en passant capture is really possible or not [2] [3] [4] . Other moves than double pawn pushes imply the symbol '-' for this FEN field.
<En passant target square> ::= '-' | <epsquare> <epsquare> ::= <fileLetter> <eprank> <fileLetter> ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' <eprank> ::= '3' | '6'
Halfmove Clock
The halfmove clock specifies a decimal number of half moves with respect to the 50 move draw rule. It is reset to zero after a capture or a pawn move and incremented otherwise.
<Halfmove Clock> ::= <digit> {<digit>} <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
Fullmove counter
The number of the full moves in a game. It starts at 1, and is incremented after each Black's move.
<Fullmove counter> ::= <digit19> {<digit>} <digit19> ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' <digit> ::= '0' | <digit19>
Samples
FEN strings of Starting Position and after 1.e4 c5 2.Nf3:
♜♞♝♛♚♝♞♜ ♟♟♟♟♟♟♟♟ ♙♙♙♙♙♙♙♙ ♖♘♗♕♔♗♘♖ |
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
♜♞♝♛♚♝♞♜ ♟♟♟♟♟♟♟♟ ♙ ♙♙♙♙ ♙♙♙ ♖♘♗♕♔♗♘♖ |
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
♜♞♝♛♚♝♞♜ ♟♟ ♟♟♟♟♟ ♟ ♙ ♙♙♙♙ ♙♙♙ ♖♘♗♕♔♗♘♖ |
rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2
♜♞♝♛♚♝♞♜ ♟♟ ♟♟♟♟♟ ♟ ♙ ♘ ♙♙♙♙ ♙♙♙ ♖♘♗♕♔♗ ♖ |
rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
Chess960
Shredder-FEN
Shredder-FEN or SMK-FEN is an extension of FEN covering Chess960, introduced by Shredder author Stefan Meyer-Kahlen (SMK) in 2005. Shredder-FEN uses different castling right characters, that is instead of KQkq, upper case and lower case file characters of the affected rooks for white and black castling rights, and became a de facto standard supported by most GUIs and protocols.
X-FEN
The earlier X-FEN extension was introduced by Reinhard Scharnagl in 2003, and covers not only Chess960 but also 10x8 variants. Its author dogmatically claimed upward compatibility with standard chess [5], still using the KQkq castling right characters for all Chess960 positions. Further, X-FEN introduced a changed en passant target square semantic, which is only specified after a double pawn push was made beside an opponent pawn that might capture en passant if legal, that is not leaving its king in check.
See also
- Extended Position Description (EPD)
- Forsyth-Edwards Expanded Notation (FEEN)
- Portable Game Notation (PGN)
- BMI2 FEN Compression
Forum Posts
1993 ...
- Revised PGN standard available by Steven Edwards, rgc, December 20, 1993 » Portable Game Notation
- Full definition for FEN by Dann Corbit, CCC, May 27, 1999
2000 ...
- File name extensions by Leen Ammeraal, CCC, November 14, 2000
- Ten years later: revising EPD/FEN/PGN by Steven Edwards, CCC, September 09, 2003
- Making positions in eps by Renze Steenhuisen, CCC, October 27, 2003 » Fen2eps
2005 ...
- Why to use compatible X-FEN (in Chess960) by Reinhard Scharnagl, CCC, July 17, 2005
- Chess960: X-FEN rules international by Reinhard Scharnagl, CCC, August 03, 2005
- contradicting FEN and SMK-FEN by Reinhard Scharnagl, CCC, August 04, 2005
- Chess960: Arena castle vs X-FEN castle by Matthias Gemuh, CCC, November 05, 2005
- fen to fen functions by Uri Blass, CCC, May 21, 2007
2010 ...
- where FEN is not consistent by Reinhard Scharnagl, CCC, January 06, 2010
- FEN string by colin, CCC, January 30, 2011
- No more pseudolegal en passant target foolishness by Steven Edwards, CCC, February 27, 2011
- What's wrong with this EPD? by Jouni Uski, CCC, March 20, 2011
- Question about Shredder FEN and X-FEN by Harm Geert Muller, CCC, April 22, 2012
- Re: Causes for inconsistent benchmark signatures by Evert Glebbeek, CCC, March 27, 2013 » En passant
- The maximum character length of a FEN string by Steven Edwards, CCC, August 24, 2013
- Is 79 maximal? by Louis Zulli, CCC, July 29, 2014
- PGN to FEN (with Evaluation)? by Steve Maughan, CCC, December 28, 2014 » Portable Game Notation, Python
2015 ...
- Binary FEN by J. Wesley Cleveland, CCC, July 24, 2015
- Any tool to convert FEN strings to diagrams? by Ted Wong, CCC, February 15, 2016
- FEN - Flipper for Windows by Matthias Gemuh, CCC, May 17, 2017 » Color Flipping, EPD
- 50 move counter in FEN and GUIs by Jouni Uski, CCC, November 12, 2019
2020 ...
- FEN and 3rd repetition rule. No information? by Luis Babboni, CCC, April 03, 2020 » Repetitions
- FEN compression by lucasart, CCC, March 17, 2021 » FEN Compression, NNUE Training
- Required fields in Forsyth-Edwards Notation (FEN) by Niels Abildskov, CCC, April 02, 2022
External Links
- Forsyth-Edwards Notation from Wikipedia
- Chess Programming - Chess Board Implementation : A FEN parser by Thomas Petzke
- FEN Database by Mathieu Pagé
- Gilith - Chess Diagram Maker by Joe Leslie-Hurd
- Chess Diagram Generator
- GitHub - bagaturchess/ChessBoardScanner: Java based Chess Board Scanner, which converts 2D chess board image into a machine readable format a.k.a. Forsyth–Edwards Notation (FEN) by Krasimir Topchiyski
- Chessforeva: 3D chess diagram from FEN » 3D Graphics Board
- Fen2eps by Dirk Baechle [6]
References
- ↑ Standard: Portable Game Notation Specification and Implementation Guide 16.1: FEN by Steven Edwards
- ↑ Re: Arasan test suite update by Steven Edwards, CCC, September 19, 2008
- ↑ where FEN is not consistent by Reinhard Scharnagl, CCC, January 06, 2010
- ↑ No more pseudolegal en passant target foolishness by Steven Edwards, CCC, February 27, 2011
- ↑ Why to use compatible X-FEN (in Chess960) by Reinhard Scharnagl, CCC, July 17, 2005
- ↑ Encapsulated PostScript from Wikipedia