Forsyth–Edwards Expanded Notation

A general purpose UTF-8-based format for defining chess variants’ board positions.

Created
Updated
Status
beta

Abstract

This document proposes a format for representing most chessboard positions, as pictures of game at a given moment.

Status of this document

This document is a beta of the FEEN specification.

Copyright notice

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.


Introduction

FEEN (Forsyth–Edwards Expanded Notation) is a lightweight, UTF-8-based format that gives a consistent and easy way to represent most chessboard positions between two-players.

Inspired by FEN (Forsyth–Edwards Notation), FEEN is able to describe both multidimensional positions and related state, easy for humans to read and write, and easy for machines to import and export, it is completely laws of chess independent and compatible with the main chess variants, including 장기Janggi, หมากรุกMakruk, 将棋Shogi, Western, 象棋Xiangqi, and many others. These properties make FEEN an ideal data-interchange format for recording chessboard positions.

Notational Conventions

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Specification goals

A specification for a Forsyth–Edwards expanded notation MUST observe the following criteria:

  1. The details of the system MUST be publicly available and free of unnecessary complexity.
  2. The details of the system MUST be non-proprietary so that users and software developers are unrestricted by concerns about infringing on intellectual property rights.
  3. The system MUST work for a variety of programs. The format SHOULD be such that it can be used by chess database programs, chess publishing programs, chess server programs, and chessplaying programs without being unnecessarily specific to any particular application class.
  4. The system MUST handle positions of games which are playable by many sides.
  5. The system MUST be easily expandable and scalable. Examples: new chessboards, new opening positions, new actors, new moves, new rules, etc.
    • The system MUST be cross-variants. It SHOULD be able to represent boards where sides MAY play different chess variants such as Janggi, Makruk, Shogi, Western, Xiangqi.
    • The system MUST handle chessboards of any dimension, such as: 2D, 3D, etc.
    • The system MUST handle chessboards of any size, such as: 8x8, 9x9, 9x9x9, etc.
  6. Finally, the system SHOULD handle the same kinds and amounts of data that are already handled by existing chess software and by print media.

How to serve FEEN

The use of the file suffix “.feen” is RECOMMENDED for files containing FEEN data.

When serving FEEN over HTTP, the media type “application/vnd.feen” is RECOMMENDED.

Notation for board positions

A FEEN description MUST have three fields:

  1. Flatten board
  2. Active side
  3. Captured actors

Each field MUST be composed only of UTF-8 characters, and non-blank printing. Adjacent fields MUST be separated by a single UTF-8 space character (i.e., “ “). When a field is blank, it MUST be “-”.

The length of a FEEN position description varies somewhat according to the position and the number of actors.

Flatten board

Actors MUST be identified by a single character; e.g., “P”, “N”, “”, “”, “”.

Blank squares are noted using digits 1 through n (where n is the number of blank squares on the last dimension). An empty string “” is used to separate actors, and between each dimension, solidus characters “/” are used.

Empty chessboard examples

6
8/8/8/8
7/7/7/7/7/7/7
5/5/5/5/5//5/5/5/5/5//5/5/5/5/5//5/5/5/5/5//5/5/5/5/5

Active side

This field MUST contain a single letter: “B” means bottom moves next, “t” means top.

Captured actors

Captured actors MUST be listed here. The actors are listed in alphabetical order, separated by an empty string “”.

If neither player has any captured actors, for instance on an initial position, this MUST be “-”.

Note: Captured actors are said to be in hand at Shogi.

Example from a game with two Shogi players, in a position where bottom (先手Sente) had captured 1 Rook, 1 Gold and 4 Pawns, while top (後手Gote) has captured 2 Bishops, 2 Silvers and 3 Pawns:

GPPPPRbbpppss

Example

Starting positions

rmes1semr/4g4/1p5p1/j1j1j1j1j/9/9/J1J1J1J1J/1P5P1/4G4/RMES1SEMR B -
rnbqkbnr/8/pppppppp/8/8/PPPPPPPP/8/RNBKQBNR B -
lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL B -
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR B -
rheagaehr/9/1c5c1/s1s1s1s1s/9/9/S1S1S1S1S/1C5C1/9/RHEAGAEHR B -

Scenario

Given the following position between two Western players:

♜♞♝♛♚♝♞♜/♟♟♟♟♟♟♟♟/8/8/8/8/♙♙♙♙♙♙♙♙/♖♘♗♕♔♗♘♖ B -

When this action (in PBDN format) is applied:

[ 52, 36, "♙" ]

Then the position becomes:

♜♞♝♛♚♝♞♜/♟♟♟♟♟♟♟♟/8/8/4♙3/8/♙♙♙♙1♙♙♙/♖♘♗♕♔♗♘♖ t -

Informative References

This work is influenced by several documents.

Contributing

Want to make this page better? Make your changes and submit a hug request.