what is fen in chess

11 months ago 27
Nature

FEN stands for Forsyth-Edwards Notation, and it is the standard notation used to describe positions of a chess game. It is a one-line ASCII string that provides all the necessary information to restart a game from a particular position. FEN is based on a system developed by Scottish newspaper journalist David Forsyth, which became popular in the 19th century. Steven J. Edwards extended it to support use by computers. FEN differs from the Portable Game Notation (PGN) because it denotes only a single position instead of the moves that lead to it.

A FEN record contains six fields, each separated by a space. The fields are as follows:

  • 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") .

  • Active color: This field indicates which player has the move. "w" means white, and "b" means black.

  • Castling availability: This field indicates which castling moves are still available. If neither side can castle, this field is "-". Otherwise, this field consists of one or more letters: "K" (white kingside), "Q" (white queenside), "k" (black kingside), and "q" (black queenside) .

  • En passant target square: If a pawn has just made a two-square move, this field indicates the square behind the pawn. Otherwise, this field is "-".

  • Halfmove clock: This field counts the number of half-moves since the last capture or pawn advance. This is used to determine if a draw can be claimed under the fifty-move rule.

  • Fullmove number: This field counts the number of full moves in the game so far. It starts at 1 and is incremented after blacks move. ...