Version: 1.0.0 Author: Cyril Kato Published: March 29, 2013 License: MIT License
FEEN is a compact, canonical, and rule-agnostic textual format for representing static board positions in two-player piece-placement games. It is designed to support multiple game types (chess, shogi, xiangqi, makruk, go, etc.) and hybrid configurations, while remaining neutral with regard to the rules of any specific game.
a-z
or A-Z
.A FEEN record consists of three space-separated fields:
<PIECE-PLACEMENT> <GAMES-TURN> <PIECES-IN-HAND>
<PIECE-PLACEMENT>
This field encodes the spatial distribution of pieces across the board. The position is always expressed from the point of view of the player who plays first in the initial position, according to the standard rules of the game(s) represented (e.g., from White’s perspective in chess).
a-z
or A-Z
. Optional modifiers may be:
+
=
, <
, or >
1
-n
, representing consecutive empty cells./
separates consecutive elements of the first inner dimension (e.g., ranks in 2D)./
, resulting in //
, ///
, etc.This generalization of FEN allows FEEN to describe n-dimensional boards with arbitrary shapes.
FEEN allows for optional prefixes and suffixes to be applied to piece identifiers. These modifiers are semantically undefined within the FEEN specification itself, but are intended to convey optional metadata about the state or capabilities of pieces. Their interpretation is left to the consuming application or game engine.
+
— Commonly used to indicate that a piece is promoted or in a special state.
Example usage:
+B
: a promoted bishop in shogi (e.g., dragon horse).=
— May denote a special capability or dual-option status.
Example usage:
P=
: a chess pawn that may be captured en passant from the left and from the right.K=
: a king eligible for both kingside and queenside castling in chess.<
— May denote a left-side constraint or condition, relative to the initial player’s perspective.
Example usage:
P<
: a pawn that may be captured en passant from the left.K<
: a king eligible for queenside castling only.>
— May denote a right-side constraint or condition, relative to the initial player’s perspective.
Example usage:
P>
: a pawn that may be captured en passant from the right.K>
: a king eligible for kingside castling only.These conventions support a richer static representation of game-specific situations (e.g., castling rights, promotion status, special capture conditions) while preserving FEEN’s rule-agnostic design.
Pieces in hand, which are available for dropping onto the board, should generally be represented without modifiers (prefixes or suffixes). This aligns with the convention used in games like shogi, where a promoted piece (indicated by the +
prefix) loses its promotion status when captured and becomes available for dropping.
Examples:
+P
(promoted pawn) on the board would be represented as simply P
in the pieces in hand list after captureK=
(king with castling rights) would be represented as K
in the pieces in hand listThis convention maintains consistency across games and simplifies the management of droppable pieces while staying faithful to the typical rules of such games.
Consumers of FEEN are encouraged to define consistent interpretation rules for modifiers within their own domain of application, while remaining compatible with the base format.
<GAMES-TURN>
This field identifies the game type associated with each player and specifies whose turn it is.
<FIRST-GAME>/<SECOND-GAME>
, where:
a-z
) and must be valid identifiers.This dual function enables unambiguous attribution of pieces to games and identification of the player to move, even in hybrid configurations (e.g., makruk vs. chess).
<PIECES-IN-HAND>
This field lists the pieces available for future placement on the board (similar to shogi drops or captured pieces in hand):
<PIECE-PLACEMENT>
, including case but generally without modifiers (prefixes or suffixes).-
).As explained in the “Pieces in Hand Behavior” section, modifiers are typically stripped when pieces are captured and become available for dropping, following conventions in games like shogi.
The following Backus-Naur Form (BNF) grammar defines the FEEN format. It supports arbitrarily nested board dimensions through a recursive structure of dimension groups, and describes all three main fields: <PIECE-PLACEMENT>
, <GAMES-TURN>
, and <PIECES-IN-HAND>
.
<feen> ::= <piece-placement> " " <games-turn> " " <pieces-in-hand>
<piece-placement> ::= <dim-group>
<dim-group> ::= <dim-element>
| <dim-element> <dim-separator> <dim-group>
<dim-element> ::= <dim-group> ; recursive case (nested dimension)
| <rank> ; base case: 1D sequence of cells
<rank> ::= <cell> | <cell> <rank>
<cell> ::= <piece> | <empty>
<piece> ::= [a-zA-Z]
| "+" [a-zA-Z]
| [a-zA-Z] <suffix>
| "+" [a-zA-Z] <suffix>
<suffix> ::= "=" | "<" | ">"
<empty> ::= <digit> | <digit> <empty> ; natural numbers (e.g., "1", "12", ...)
<dim-separator> ::= "/" <separator-tail>
<separator-tail> ::= "" ; "/" → base level
| "/" <separator-tail> ; allows multiple slashes (//, ///, etc.)
<games-turn> ::= <game-id-uppercase> "/" <game-id-lowercase>
| <game-id-lowercase> "/" <game-id-uppercase>
<game-id-uppercase> ::= <identifier> ; must contain at least one uppercase letter
<game-id-lowercase> ::= <identifier> ; must be all lowercase
<identifier> ::= <letter> | <letter> <identifier>
<letter> ::= "a"-"z" | "A"-"Z"
<pieces-in-hand> ::= "-"
| <piece> <pieces-in-hand>
When <pieces-in-hand>
is not -
, it consists of one or more <piece>
symbols, listed in strict ASCII lexicographic order and concatenated without delimiters.