sashite.dev

Forsyth-Edwards Essential Notation (FEEN) Specification

Version: 1.0.0 Author: Cyril Kato Published: March 29, 2013 License: MIT License


Overview

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.


Properties


Constraints


Format

A FEEN record consists of three space-separated fields:

<PIECE-PLACEMENT> <GAMES-TURN> <PIECES-IN-HAND>

Field 1: <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).

This generalization of FEN allows FEEN to describe n-dimensional boards with arbitrary shapes.


Optional Semantics for Piece Modifiers

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.

Prefixes

Suffixes

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 Behavior

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:

This 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.


Field 2: <GAMES-TURN>

This field identifies the game type associated with each player and specifies whose turn it is.

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


Field 3: <PIECES-IN-HAND>

This field lists the pieces available for future placement on the board (similar to shogi drops or captured pieces in hand):

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.


Formal Grammar (BNF)

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 (Recursive n-Dimensional Support)

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

Game Turn

<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

<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.