We use FEN files, a cute small one line files, that describe a chess position and its environment, in many cases.
I had a position in a game with a FEN file, but I needed to have the FEN file for a position that is a few moves before the one I had. playing the moves backwards didn't help, so I decided to know how is FEN made to be able to modify it. Here is what I found on wikipedia. It helped, and was very interesting:
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 have the file extension ".fen".
A FEN record contains six fields. The separator between fields is a space. The fields are:
Piece placement (from white's perspective). Each rank is described, starting with rank 8 and ending with rank 1; within each rank, the contents of each square are described from file a through file h. Following the Standard Algebraic Notation (SAN), each piece is identified by a single letter taken from the standard English names (pawn = "P", knight = "N", bishop = "B", rook = "R", queen = "Q" and king = "K").[1] White pieces are designated using upper-case letters ("PNBRQK") while black pieces use lowercase ("pnbrqk"). Blank squares are noted using digits 1 through 8 (the number of blank squares), and "/" separate ranks.
Active color. "w" means white moves next, "b" means black.
Castling availability. If neither side can castle, this is "-". Otherwise, this has one or more letters: "K" (White can castle kingside), "Q" (White can castle queenside), "k" (Black can castle kingside), and/or "q" (Black can castle queenside).
En passant target square in algebraic notation. If there's no en passant target square, this is "-". If a pawn has just made a 2-square move, this is the position "behind" the pawn. This is recorded regardless of whether there is a pawn in position to make an en passant capture.[2]
Halfmove clock: This is the number of halfmoves since the last pawn advance or capture. This is used to determine if a draw can be claimed under the fifty-move rule.
Fullmove number: The number of the full move. It starts at 1, and is incremented after Black's move.
We use FEN files, a cute small one line files, that describe a chess position and its environment, in many cases.
I had a position in a game with a FEN file, but I needed to have the FEN file for a position that is a few moves before the one I had. playing the moves backwards didn't help, so I decided to know how is FEN made to be able to modify it. Here is what I found on wikipedia. It helped, and was very interesting:
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 have the file extension ".fen".
A FEN record contains six fields. The separator between fields is a space. The fields are:
[edit] Examples
Here is the FEN for the starting position:
Here is the FEN after the move 1. e4:
And then after 1. ... c5:
And then after 2. Nf3: