====== Chess - Programming - FEN (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.
----
The starting position:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
**NOTE:** A FEN record contains six fields, separated by spaces.
The fields are:
* Piece placement.
* **rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR**: The Piece Placement.
* **/**: The next rank.
* **Digits 1-8**: The number of empty squares until the next piece on the rank.
* Active color:
* **w** means White moves next,
* **b** means Black moves next.
* Castling availability.
* **-**: Neither side can castle.
* **K**: White can castle kingside,
* **Q**: White can castle queenside,
* **k**: Black can castle kingside,
* **q**: Black can castle queenside.
* En passant target square in algebraic notation:
* **-**: There is no en passant target square.
* This is recorded regardless of whether there is a pawn in position to make an en passant capture.
* Halfmove clock: The number of halfmoves since the last capture or pawn advance, used for the fifty-move rule.
* Fullmove number: The number of the full move. It starts at 1, and is incremented after Blacks move.
----
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Ambiguation|Test Ambiguation]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Castling|Test Castling]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Castling Prevented|Test Castling Prevented]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Castling|Test Castling]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Discovered Check|Test Discovered Check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Double Check|Test Double Check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test End Games|Test End Games]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Enpassant capture gives check|Test Enpassant capture gives check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Huge Number of Moves|Test Huge Number of Moves]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Incorrect Positions|Test Incorrect Positions]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Long castling gives check|Test Long castling gives check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Move Generation|Test Move Generation]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Pawn Shield|Test Pawn Shield]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Perft|Test Perft]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Positions|Test Positions]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Promote out of check|Test Promote out of check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Promotion gives check|Test Promotion gives check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Self Stalemate|Test Self Stalemate]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Short castling gives check|Test Short castling gives check]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Stalemate|Test Stalemate]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Static Exchange|Test Static Exchange]]
[[Chess:Programming:FEN (Forsyth-Edwards Notation):Test Underpromotion gives check|Test Underpromotion gives check]]
----
===== References =====
https://timkr.home.xs4all.nl/records/records.htm