Forsyth–Edwards Enhanced Notation (FEEN) Specification
- Version: 1.0.0
- Author: Sashité
- Published: May 1, 2025
- 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 systems and hybrid configurations, while remaining neutral with regard to the rules of any specific game.
FEEN extends the traditional FEN notation to support cross-style scenarios, arbitrary board dimensions, and captured pieces management, making it suitable for a wide range of abstract strategy games including western chess, shōgi, xiangqi, makruk, janggi, and many other board game systems.
Game Protocol Foundation
The fundamental game concepts used in this document are interpreted as described in the Game Protocol.
Properties
- FEEN is rule-agnostic and does not encode legality, move counters, or game-specific conditions.
- FEEN enforces a canonical representation, ensuring that equivalent positions yield identical strings.
- FEEN supports hybrid or cross-style positions involving different piece sets.
- FEEN supports arbitrary-dimensional board configurations for games like 3D chess variants.
- FEEN is suitable for static storage, comparison, and visual reconstruction of positions.
- FEEN provides piece group classification through case-based notation, dividing pieces into first player and second player groups.
Constraints
- FEEN supports exactly two players.
- A maximum of 26 unique native pieces per player, extensible to 52 with PNN derivation markers (
'
). - Players must be assigned distinct casing (uppercase/lowercase) for their associated style identifiers to ensure proper disambiguation.
Format
A FEEN record consists of the following three space-separated fields:
<PIECE-PLACEMENT>
— Specifies the configuration of pieces on the board, possibly in multiple dimensions.<PIECES-IN-HAND>
— Lists any off-board pieces available to each player, separated by player and sorted within each player group.<STYLE-TURN>
— Indicates which player is to move, and associates piece casing with style identities.
These fields are combined into a single FEEN string like:
<PIECE-PLACEMENT> <PIECES-IN-HAND> <STYLE-TURN>
Fundamental Concepts
Piece Representation
FEEN relies on the Piece Name Notation (PNN) specification for representing individual pieces. PNN provides a consistent way to identify pieces and their states across various board games.
Key PNN Elements in FEEN Context
- Pieces are denoted using single ASCII characters
a-z
orA-Z
. - Case distinguishes between controlling players (uppercase for first player, lowercase for second).
- Optional modifiers may be applied to pieces both on the board and in hand:
- Prefix: “
-
” (diminished state) or “+
” (enhanced state) - Suffix: “
'
” (derivation marker for cross-style scenarios)
- Prefix: “
- The specific meaning of modifiers depends on the game context, but FEEN remains agnostic about their interpretation.
Style Identification and GAN Inference
FEEN positions can be converted to General Actor Notation (GAN) identifiers using the <STYLE-TURN>
field. Each piece’s complete GAN identifier is inferred by combining:
- The appropriate style identifier from
<STYLE-TURN>
based on the piece’s PNN notation - The piece’s PNN representation
GAN Inference Rules
For all pieces (both <PIECE-PLACEMENT>
and <PIECES-IN-HAND>
):
Native pieces (without derivation marker '
):
- Uppercase pieces (
K
,+Q
,-R
) → Use the uppercase style identifier from<STYLE-TURN>
- Lowercase pieces (
k
,+q
,-r
) → Use the lowercase style identifier from<STYLE-TURN>
Derived pieces (with derivation marker '
):
- Uppercase pieces (
K'
,+Q'
,-R'
) → Use the lowercase style identifier from<STYLE-TURN>
- Lowercase pieces (
k'
,+q'
,-r'
) → Use the uppercase style identifier from<STYLE-TURN>
This enables accurate GAN inference for both traditional single-style games and cross-style scenarios where pieces may be captured and transformed between different style systems.
Piece Ownership and Capture Logic
FEEN supports dynamic piece ownership where pieces can change hands through capture and redeployment (as in Shōgi-style games).
Ownership Rules
- Board pieces: Current owner determined by piece case (uppercase = first player, lowercase = second player)
- Hand pieces: Current owner determined by position relative to
/
separator (left = first player, right = second player) - Capture process: Piece removed from board, transformed according to game rules, then added to capturing player’s hand
- Redeployment: Pieces from hand can be placed on board, depending on game rules
Game-Specific Transformations
FEEN accommodates different capture transformation rules:
- Chess-style games: Captured pieces typically lose modifiers and retain their original PNN identity when moved to hand
- Shōgi-style games: Captured pieces typically lose modifiers and may change case when moved to hand
- Custom games: Any transformation rule can be represented as long as the result is valid PNN
The specific transformation applied depends entirely on the game rules being played, not on FEEN itself.
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.
Encoding Rules
- The board is traversed starting from the outermost dimension and proceeding inward, dimension by dimension.
- Pieces are denoted using PNN notation (including modifiers for pieces on the board).
- Empty spaces are compressed using digits
1
-n
, representing consecutive empty cells. - Dimension separators:
/
separates consecutive elements of the first inner dimension.- Each higher-level dimension adds an additional
/
, resulting in//
,///
, etc.
- Pieces are not separated by delimiters; their identity and grouping are inferred from their individual characters.
Multi-Dimensional Support
This generalization allows FEEN to describe n-dimensional boards with arbitrary shapes:
- 2D boards: Standard format with
/
separators between ranks - 3D boards: Use
//
to separate planes,/
to separate ranks within planes - Higher dimensions: Continue pattern with additional
/
characters
Irregular Board Shapes
FEEN can represent boards with irregular shapes by varying the number of cells per rank:
8/7/8/8/8/8/8/8 # 8x8 board with one rank having only 7 cells
Field 2: <PIECES-IN-HAND>
This field lists pieces held by each player that are not currently on the board. Depending on the game rules, these pieces may represent captured pieces, initial reserves, or other off-board pieces. Whether these pieces can be placed on the board in future moves depends entirely on the specific game being played. The format uses a forward slash (/
) as a separator between the two players’ pieces.
Pieces in hand are represented using full PNN notation, including any applicable modifiers (prefixes and suffixes).
Accessibility principle: While board pieces are universally accessible to both players (subject to game rules), hand pieces maintain strict accessibility boundaries - each player can only access their designated reserve section.
Format Structure
The <PIECES-IN-HAND>
field follows the pattern:
<PIECES-HELD-BY-FIRST-PLAYER>/<PIECES-HELD-BY-SECOND-PLAYER>
Where:
<PIECES-HELD-BY-FIRST-PLAYER>
represents pieces currently held by the first player<PIECES-HELD-BY-SECOND-PLAYER>
represents pieces currently held by the second player- The separator
/
is always present, even when one or both sides have no pieces
Key Principle: Rule-Agnostic Piece Control Representation
Important: FEEN is completely agnostic to how pieces enter the <PIECES-IN-HAND>
field. When a piece moves from the board to hand:
- The piece is removed from the
<PIECE-PLACEMENT>
field - A piece is added to the appropriate section of
<PIECES-IN-HAND>
based on which player now controls it - The piece identity (case, letter, modifiers) of the added piece depends entirely on the specific game rules being played
Examples of different control scenarios:
- Chess capture: White queen captures black bishop
b
→ black bishopb
is removed from board → black bishopb
is added to white’s hand (piece retains original identity) - Shōgi capture: Sente rook captures gote promoted bishop
+b
→ promoted bishop+b
is removed from board → unpromoted bishopB
is added to sente’s hand (note the case change and modifier removal according to shōgi rules) - Go initial position: Each player starts with a reserve of stones in their goke →
181S/181s
represents the initial stone reserves - Handicap games: Some pieces may be removed at game start and held by a specific player
The controlling player is determined by which side of the /
separator the piece appears on, not by the piece’s case or original identity.
Encoding Rules
Player Separation
- Left side (before
/
): Contains pieces currently held by the first player - Right side (after
/
): Contains pieces currently held by the second player - If a player has no pieces in hand, their side remains empty (but the
/
separator is still present)
Piece Representation
- Pieces are represented using their full PNN identifiers as determined by the game rules (including any modifiers and case as specified by the rules for pieces in hand)
- Quantity notation:
- Single occurrence: no numeric prefix (e.g., “
p
”, “+K
”, “R'
”) - Multiple occurrences: numeric prefix required (e.g., “
2p
”, “3+K
”, “5R'
”) - The numeric prefix cannot be “
0
” or “1
”
- Single occurrence: no numeric prefix (e.g., “
Sorting Rules
Within each player’s section, pieces are sorted by:
- Quantity (descending): Pieces with higher quantities appear first
- Base letter (ascending): Within the same quantity, pieces are sorted alphabetically by their base letter, case-insensitive
- Case (uppercase first): For the same base letter, uppercase comes before lowercase
- Prefix (specific order): For the same base letter and case, order by prefix:
-
,+
, then no prefix - Suffix (specific order): For the same prefix, order by suffix: no suffix, then
'
Sorting example:
- Input:
ppR+p'PPP+K'ks'S-pB+b+B+p'BBBppprS-P-p'-PRb
- Sorted result:
3B+b5bK+K'3-p-p'3+p'6pR2rS'sS
Canonical Benefits
This approach provides several advantages:
- Rule agnosticism: FEEN doesn’t need to know specific rules for how pieces enter or leave the hand
- Universal applicability: Works with captured pieces (chess, shōgi), initial reserves (go), handicap pieces, or any other off-board piece control mechanism
- Complete game state: All pieces controlled by each player are tracked regardless of their origin or transformation
- Cross-style compatibility: Works with any game’s piece control rules, from chess (identity preservation) to shōgi (transformation) to go (stone reserves)
Field 3: <STYLE-TURN>
This field identifies the style type associated with each player and specifies whose turn it is.
Format Structure
The format is <ACTIVE-STYLE>/<INACTIVE-STYLE>
, where:
- The first style identifies the player currently to move (active player)
- The second style identifies the opponent (inactive player)
- Each style identifier conforms to Style Name Notation (SNN) specification
- Casing is semantically significant: exactly one style must be uppercase, the other must be lowercase
- The uppercase style identifies the style system associated with the first player (pieces controlled by first player: uppercase pieces in
<PIECE-PLACEMENT>
and pieces on left side of<PIECES-IN-HAND>
) - The lowercase style identifies the style system associated with the second player (pieces controlled by second player: lowercase pieces in
<PIECE-PLACEMENT>
and pieces on right side of<PIECES-IN-HAND>
)
- The uppercase style identifies the style system associated with the first player (pieces controlled by first player: uppercase pieces in
Player-Style Association
The association between players and style casing remains fixed throughout the game:
- First player: Always associated with uppercase style identifier and uppercase pieces
- Second player: Always associated with lowercase style identifier and lowercase pieces
Style Attribution with PNN
According to PNN derivation rules, piece style attribution works as follows:
First player’s style (uppercase style identifier):
- Native pieces: Uppercase pieces without derivation marker (e.g.,
K
,Q
,R
) - Derived pieces: Lowercase pieces with derivation marker (e.g.,
k'
,q'
,r'
)
Second player’s style (lowercase style identifier):
- Native pieces: Lowercase pieces without derivation marker (e.g.,
k
,q
,r
) - Derived pieces: Uppercase pieces with derivation marker (e.g.,
K'
,Q'
,R'
)
This enables cross-style scenarios where captured pieces retain their original casing while being controlled by the capturing player.
Turn Indication
The order of styles indicates whose turn it is:
- When the uppercase style appears first:
CHESS/chess
→ First player to move - When the lowercase style appears first:
chess/CHESS
→ Second player to move
This dual function enables both style attribution and turn identification, supporting hybrid configurations where different players use different piece systems.
Examples
CHESS/chess
- Western chess white player (uppercase pieces) to moveshogi/SHOGI
- Japanese chess gote player (lowercase pieces) to moveXIONGQI/ogi
- Chinese chess red player (uppercase pieces) to move (in a hybrid game)
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.
<feen> ::= <piece-placement> <whitespace> <pieces-in-hand> <whitespace> <style-turn>
<whitespace> ::= " "
Piece Placement (Recursive n-Dimensional Support)
<piece-placement> ::= <dim-group>
<dim-group> ::= <dim-element>
| <dim-element> <dim-separator> <dim-group>
<dim-element> ::= <dim-group> ; nested dimension (recursive case)
| <rank> ; base case: 1D sequence of cells
<rank> ::= <cell>
| <cell> <rank>
<cell> ::= <piece> | <number>
<piece> ::= <pnn-piece> ; As defined in the PNN specification
<number> ::= <non-zero-digit>
| <non-zero-digit> <digits>
<non-zero-digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
<digit> ::= "0" | <non-zero-digit>
<digits> ::= <digit>
| <digit> <digits>
<dim-separator> ::= <slash> <separator-tail>
<separator-tail> ::= "" ; base level: one slash
| <slash> <separator-tail> ; additional nesting: //, ///, etc.
<slash> ::= "/"
Pieces in Hand (Simplified Format)
<pieces-in-hand> ::= <first-player-pieces> <slash> <second-player-pieces>
<first-player-pieces> ::= ""
| <piece-sequence>
<second-player-pieces> ::= ""
| <piece-sequence>
<piece-sequence> ::= <piece-entry>
| <piece-entry> <piece-sequence>
<piece-entry> ::= <pnn-piece>
| <count> <pnn-piece>
<count> ::= <digit-2-9>
| <digit-1-9> <digits>
<digit-2-9> ::= "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
<digit-1-9> ::= "1" | <digit-2-9>
<digit> ::= "0" | <digit-1-9>
<digits> ::= <digit>
| <digit> <digits>
<slash> ::= "/"
<pnn-piece> ::= <letter> ; As defined in PNN specification
| <prefix> <letter> ; Including all modifiers
| <letter> <suffix>
| <prefix> <letter> <suffix>
<prefix> ::= "+" | "-"
<suffix> ::= "'"
<letter> ::= <letter-lowercase> | <letter-uppercase>
<letter-lowercase> ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j"
| "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t"
| "u" | "v" | "w" | "x" | "y" | "z"
<letter-uppercase> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J"
| "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
| "U" | "V" | "W" | "X" | "Y" | "Z"
Style Turn
<style-turn> ::= <style-id-uppercase> <slash> <style-id-lowercase>
| <style-id-lowercase> <slash> <style-id-uppercase>
<slash> ::= "/"
<style-id-uppercase> ::= <snn-uppercase> ; As defined in the SNN specification
<style-id-lowercase> ::= <snn-lowercase> ; As defined in the SNN specification
Related Specifications
FEEN is part of a family of specifications designed to provide a comprehensive and rule-agnostic representation system for abstract strategy board games:
Direct Dependencies
- Style Name Notation (SNN) - Defines the format for representing style identifiers. Critical for FEEN’s style identification in the
<STYLE-TURN>
field. - Piece Name Notation (PNN) - Defines the format for representing individual pieces and their states. Critical for FEEN’s piece identification in both
<PIECE-PLACEMENT>
and<PIECES-IN-HAND>
fields.
Compatible Specifications
- General Actor Notation (GAN) - Provides a style-qualified piece identifier format that can be inferred from FEEN positions based on current ownership.
Examples and Applications
For comprehensive examples covering all aspects of FEEN including:
- Traditional and cross-style games
- Multi-dimensional board representations
- Piece capture and state modifier scenarios
- GAN inference examples
- Implementation guidelines
- Performance considerations
See: FEEN Examples
Reference Implementations
This section lists available libraries and tools that implement the FEEN specification.
Ruby
- Feen.rb - Full implementation of the FEEN specification for Ruby, including conversion from/to various formats, as well as support for hybrid games and arbitrary dimensions.