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

PCN Examples

Comprehensive examples demonstrating Portable Chess Notation v1.0.0 across various recording scenarios, per-player time control systems, and game types.

Time control lives per player. Define it in sides.first.periods and sides.second.periods. If a side’s periods is omitted or an empty array, that side has no time limit.


Available Examples

Minimal Documents

Smallest valid PCN documents, from absolute minimum to basic records. Featured: Empty boards, chess starting positions, minimal metadata.

Time Control Systems

End-to-end demonstrations of PCN’s period-based time control. Featured: Bank (moves=null), Per-move (moves=1, cap rule), Quota/Canadian (moves≥2), asymmetric handicap, and no-time cases.

Traditional Games

Standard board game recordings using PCN. Featured: Western Chess, Japanese Shōgi, Chinese Xiangqi (complete records).

Special Moves

Non-standard move mechanics using PAN. Featured: Castling (~), en passant (~), promotion (=), drops (*), static captures (+).

Game Status

Game termination and status conditions via CGSN. Featured: Checkmate, stalemate, resignation, time limit, insufficient material, in progress.

Draw Offer Scenarios

Draw proposal and acceptance patterns using the draw_offered_by field. Featured: Pending offers, accepted draws, proposer tracking, mutual agreements.

Cross-Style Games

Games where players use different rule systems. Featured: Chess vs Makruk, Chess vs Shōgi, asymmetric styles.

Positions Without Moves

PCN documents used for position recording rather than full games. Featured: Puzzles, endgame studies, tactical and opening positions.

Complete Game Records

Full-featured examples combining metadata, players, time control, moves, and status. Featured: Tournament games, rated matches, cross-style competitions.


Quick Reference

Basic Structure

{
  "meta":   { /* Optional metadata */ },
  "sides":  { /* Optional player info + per-player periods */ },
  "setup":  "/* Required FEEN position */",
  "moves":  [ /* Optional [PAN, seconds] tuples */ ],
  "draw_offered_by": /* Optional: "first" | "second" | null */,
  "status": /* Optional CGSN value */
}

Move Tuples

All moves are pairs with PAN and time spent (float ≥ 0.0):

["e2-e4", 8.0]

Time Control (per player)

Period objects (defaults in parentheses):

"periods": [
  { "time": 300, "moves": null, "inc": 3 }  // moves defaults to null (bank), inc defaults to 0
]

Active Player Derivation

Let side0 be the side to move in FEEN setup; with n = moves.length:

active = (n % 2 == 0) ? side0 : opposite(side0)