Sashité for Developers
  1. Sashité for Developers
  2. Specifications
  3. PCN
  4. 1.0.0

Portable Chess Notation (PCN) Specification


1. Status of this document

The key words MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY are to be interpreted as normative requirements.

Capitalized terms (Match, Position, Ply, Move, Action, Game, Rule System, Period, Piece, Piece Style, Player Side, Active Player) are defined in the Glossary and the Game Protocol.


2. Overview

Portable Chess Notation (PCN) is a format for recording complete Matches in abstract strategy board games built on the Sashité Game Protocol.

A PCN document encodes:

PCN is:


3. Dependencies

PCN depends on:

PCN optionally depends on:

PCN permits alternative notations (FEN, SAN, UCI, etc.) via custom properties, delegating format validation to context-specific implementations.


4. Serialization formats

PCN documents MAY be serialized in either TOML or JSON.

4.1 Format detection

Implementations SHOULD detect the format by:

  1. File extension: .toml for TOML, .json for JSON.
  2. Content inspection: presence of [ table headers indicates TOML; { as first non-whitespace character indicates JSON.

4.2 Structural equivalence

Both formats encode the same logical structure. The mapping is direct:

4.3 Encoding


5. Overall structure

A PCN document has the following top-level structure:

Section Type Required Description
meta object No Match metadata
links array No External resource links
periods array No Time control periods
sides object No Player information
setup object Yes Initial Position
plies array No Sequence of moves
outcome object No Match result

Only the setup section is required. All other sections are optional.


6. Meta object

The meta object encodes Match metadata (all properties optional):

Property Type Description
name string Match/game name
event string Tournament or event label
round string Round identifier within an event
site string Venue (physical location or virtual platform)
started_at datetime Match start time in ISO 8601 format
rule_system string Rule system identifier (e.g., "standard", "antichess")
platform_name string Platform or application name (e.g., "lichess", "chess.com")
comment string Free-text narrative about the overall Match

6.1 Datetime format

The started_at property MUST use ISO 8601 format:


The links array contains references to external resources:

Property Type Required Description
rel string Yes Relationship type
url string Yes URL of the linked resource

7.1 Relationship types

Common rel values include:

Value Description
"canonical" Authoritative URL for this Match
"source" Original source of the game record
"analysis" Link to analysis or commentary
"video" Link to video coverage
"next" Next game in a series
"prev" Previous game in a series

Custom relationship types are permitted.


8. Periods array

Time control is specified as an array of Period objects. Each entry describes one Period:

Property Type Required Description
duration_ms integer >= 0 Yes Time budget in milliseconds
increment_ms integer >= 0 No Fischer increment per Ply in milliseconds
plies integer >= 1 No Move-count quota — time covers N plies, then repeats

8.1 Time control semantics

8.2 Multi-period time control

When multiple Periods are specified, they are applied in sequence. A typical pattern is a main time bank followed by overtime periods.


9. Sides object

The sides object contains first and second player objects (both optional):

Property Type Description
variant string Movement tradition in SNN format (e.g., "Chess", "Shogi")
name string Player name, handle, or identifier
elo integer >= 0 Rating (if applicable)

All properties within each side are optional.

9.1 Variant property

The variant property, if present, MUST be a valid SNN token. It identifies the movement tradition or game family associated with that player’s pieces.

In standard games, both players typically have the same variant. In hybrid or cross-variant games, players MAY have different variants.


10. Setup object

The setup object describes the initial Position of the Match:

Property Type Required Description
feen string Conditional Position in FEEN format

10.1 Position notation requirement

At least one Position notation MUST be present. If feen is present, it is canonical. Alternative notations (e.g., fen, sfen) MAY be supplied as additional properties.

10.2 Custom notations

Implementations MAY recognize additional position notations:

Property Description
fen Standard chess FEN
sfen Shogi FEN variant

If multiple notations exist, feen is preferred as canonical; others are informational.


11. Plies array

Plies are encoded as an array of objects. Each Ply records a single Player’s action in one turn.

11.1 Ply properties

Property Type Required Description
pmn string No Move in PMN format
feen string No Resulting Position in FEEN format
elapsed_ms integer >= 0 No Time spent on this Ply in milliseconds
assessment string (enum) No Move quality assessment
comment string No Free-text narrative
check boolean No Whether this move delivers check
mate boolean No Whether this move delivers checkmate
draw_offer boolean No Whether the Active Player offered/accepted a draw
variations array No Alternative lines from this position

At least one property SHOULD be present (otherwise the Ply record is semantically vacuous).

11.2 Assessment values

The assessment property accepts values corresponding to standard PGN Numeric Annotation Glyphs:

Value PGN NAG Description
"good" ! 1 Good move
"mistake" ? 2 Mistake
"brilliant" !! 3 Brilliant move
"blunder" ?? 4 Blunder
"interesting" !? 5 Interesting/speculative move
"dubious" ?! 6 Dubious/questionable move

11.3 Check and mate

The check and mate properties are boolean flags:

These properties are informational; the actual game state is determined by the Rule System.

11.4 Draw offer semantics

The draw_offer property indicates whether the Active Player has offered or accepted a draw on this Ply:

Negotiation protocol:

11.5 Variations

The variations array contains alternative lines that could be played from the current position. Each variation is an object with:

Property Type Description
comment string Commentary on this variation
plies array Sequence of Ply objects in this variation

Variations MAY be nested (variations within variations) to represent complex analysis trees.

11.6 Custom properties

Any additional properties are allowed and carry no normative semantics. Common custom properties include:

Property Description
san Standard Algebraic Notation
uci Universal Chess Interface notation
eval Engine evaluation score
depth Engine search depth
engine Engine name

12. Ply sequencing and turn alternation

Invariant:

Indexing:


13. Outcome object

The outcome object encodes the competitive result:

Property Type Required Description
result string Yes Match result code

13.1 Result values

Value Description
"1-0" First Player wins
"0-1" Second Player wins
"1/2-1/2" Draw
"1/2-0" First Player draws, Second Player forfeits
"0-1/2" First Player forfeits, Second Player draws
"1-1/2" First Player wins, Second Player takes half-point
"1/2-1" First Player takes half-point, Second Player wins

13.2 Outcome omission

If outcome is absent, the Match is either in progress or outcome not yet determined.


14. Extensibility

14.1 Custom properties

Implementations and users MAY add custom properties at any level:

Custom properties MUST NOT use names already assigned to semantic properties.

14.2 Position notations

While FEEN is the default, alternative notations MAY be supplied in both setup and individual plies.

14.3 Ply notations

Ply actions MAY be recorded in multiple notations. If multiple exist, pmn is canonical; others are informational.


15. Validation rules

15.1 Structural validation (MUST)

  1. Document is valid TOML or valid JSON.
  2. Top level is an object/table.
  3. meta, sides, sides.first, sides.second, setup, outcome are optional objects.
  4. links, periods, plies are optional arrays.
  5. The setup object MUST be present with at least one Position notation.

15.2 Semantic validation (MUST, where applicable)

  1. assessment (if present): MUST be one of the six valid enum values.
  2. result (if present): MUST be one of the seven valid result strings.
  3. duration_ms (if present): MUST be an integer >= 0.
  4. increment_ms (if present): MUST be an integer >= 0.
  5. plies (Period property, if present): MUST be an integer >= 1.
  6. elapsed_ms (if present): MUST be an integer >= 0.
  7. elo (if present): MUST be an integer >= 0.
  8. variant (if present): MUST be a valid SNN token.
  9. check, mate, draw_offer (if present): MUST be booleans.
  10. Position notation (if present): syntax validation delegated to respective spec (FEEN, FEN, etc.).
  11. pmn (if present): syntax validation delegated to PMN spec.

15.3 Semantic validation (SHOULD, context-dependent)

When Rule System context is available, implementations SHOULD additionally validate:


16. Semantics NOT defined by PCN

PCN is deliberately agnostic to:


17. Robustness considerations

Implementations SHOULD defend against resource abuse:


18. Examples

See PCN Examples for comprehensive usage patterns including:


19. JSON Schema

A JSON Schema for PCN is published for programmatic validation:

Implementations MAY rely on this schema as a baseline validator and add further semantic checks as needed.


20. Reference implementations

The following reference libraries are maintained by Sashité and are intended to be idiomatic, fully tested, and spec-accurate implementations of PCN v1.0.0.

They generally provide:

If a library behavior appears to conflict with this document, this specification is normative. Please report issues (or propose clarifications) on the relevant repository.


21. License

This specification is made available under the terms of the Open Web Foundation Agreement 1.0 (OWFa 1.0).

The authoritative legal text is the OWF “Final Specification Agreement (OWFa 1.0)”.