Sashité for Developers
  1. Sashité for Developers
  2. Documentation
  3. PAN
  4. 1.0.0
  5. Examples

PAN Examples


Overview

This document provides comprehensive examples of PAN (Portable Action Notation) usage across various game types and board configurations. These examples illustrate practical applications of the PAN specification using CELL coordinates and HAND locations.

Note: All examples are for illustration purposes only. PAN does not define or assume any game-specific rules, movement patterns, or win conditions.


Basic Move Types

Simple Movements

# 2D board movements
e2-e4      # Pawn advance (chess-style)
d7-d5      # Two-square pawn move
g1-f3      # Knight development
f1-c4      # Bishop development

# Long-range movements
a1-a8      # Rook movement (full rank)
d1-h5      # Queen diagonal movement
h1-f1      # Castling rook movement

Capture Movements

# Standard captures
e4xd5      # Pawn captures pawn
f3xe5      # Knight captures piece
d4xe5      # Central pawn capture
b5xa6      # Side pawn capture

# Long-range captures
a1xd1      # Rook captures along rank
c4xf7      # Bishop captures diagonally
d1xd8      # Queen captures vertically

Placement from Reserve

# Drops from hand/reserve
*e4        # Place piece at e4
*g5        # Drop at g5
*c3        # Place at c3
*h7        # Drop near promotion area

# Corner and edge placements
*a1        # Corner placement
*h8        # Opposite corner
*d1        # Back rank drop
*e8        # Promotion rank placement

Capture-to-Reserve

# Captures to hand/reserve
e5*        # Capture piece at e5 to reserve
d4*        # Take piece to hand
f7*        # Capture and remove to reserve
g6*        # Capture piece off board

Multi-Dimensional Examples

3D Chess (Raumschach-style)

# Simple 3D movements
e2A-e4A    # Forward move on level A
d4B-d4C    # Vertical movement between levels
c3A-f6C    # 3D diagonal movement

# 3D captures
e4Axd5B    # Capture between levels
f3A-g5C    # 3D knight-style movement
a1A-h8C    # Full 3D diagonal

# 3D placements and captures to reserve
*e4B       # Place piece on middle level
d5C*       # Capture piece from upper level to reserve

4D and Higher Dimensions

# 4D movements (theoretical)
a1Aa-b2Bb  # 4D diagonal movement
e4Ab-e4Ac  # Movement in 4th dimension

# Higher-dimensional captures
f3Ba-g4Cb  # 4D capture movement
d5Cc*      # Capture from 4D position to reserve

Game-Specific Examples

Western Chess Patterns

# Opening moves
e2-e4      # King's pawn opening
d2-d4      # Queen's pawn opening
g1-f3      # King's knight development
b1-c3      # Queen's knight development

# Typical captures
e4xd5      # Central pawn capture
f3xe5      # Knight takes pawn
d1xd8      # Queen trade

# Castling components (kingside)
e1-g1      # King castling move
h1-f1      # Rook castling move

# En passant capture pattern
e5xf6      # En passant capture (apparent diagonal to empty square)

# Promotion moves (appear as simple movement)
e7-e8      # Pawn promotion (choice not specified in PAN)

Shōgi-style Patterns

# Traditional movements
g3-g4      # Pawn advance
h1-g2      # Silver diagonal movement
i1-h1      # Lance movement

# Captures in shōgi context
g4xf4      # Pawn captures
h2xg3      # Silver captures

# Drop movements (from hand)
*g5        # Drop pawn
*e6        # Drop piece from hand
*d4        # Place captured piece

# Captures to hand
f4*        # Capture piece to hand
g3*        # Take piece for later use

Go-style Placements

# Stone placements
*d4        # Place stone at star point
*q16       # Corner placement (19x19 board)
*d16       # Star point placement
*k10       # Center placement

# Captures in Go context
f5*        # Capture stone(s) to reserve

Xiangqi Patterns

# Cannon movements
h1-h9      # Cannon advance
b3xb8      # Cannon capture (jumping)

# General movements
e1-f1      # General side step
e9-e8      # General forward

# Advisor movements
d1-e2      # Advisor diagonal
f9-e8      # Advisor retreat

Board Shape Examples

Irregular Boards

# Hexagonal coordinates (if using CELL extension)
a1-b2      # Hex movement
c3xd4      # Hex capture

# Circular boards
a1-l1      # Movement around circular board
*f6        # Placement on circular board

Variable-Size Boards

# Large boards (using CELL multi-character support)
aa1-bb2    # Movement on extended board
z26-aa27   # Cross-boundary movement
*mm13      # Center placement on large board

# Small boards
a1-c3      # Movement on small board
b2*        # Capture to reserve on small board

Complex Scenarios

Multiple Captures in Sequence

# Individual capture moves (sequence context)
e4xd5      # First capture
c4xd5      # Recapture
f6xe5      # Counter-capture
d2xe3      # En passant-style

Exchange Patterns

# Piece exchanges (individual moves)
c4xd5      # Initiate exchange
e6xd5      # Complete exchange
f4xe5      # Continue exchange
d6xe5      # Finish exchange

Castling Decomposition

# Kingside castling (two separate moves)
e1-g1      # King movement
h1-f1      # Rook movement

# Queenside castling (two separate moves)
e1-c1      # King movement
a1-d1      # Rook movement

Integration with FEEN Positions

Before and After States

Initial Position (FEEN):

+rnbq+kbn+r/pppppppp/8/8/8/8/PPPPPPPP/+RNBQ+KBN+R / CHESS/chess

PAN Move: e2-e4

Resulting Position (FEEN):

+rnbq+kbn+r/pppppppp/8/8/4P3/8/PPPP1PPP/+RNBQ+KBN+R / chess/CHESS

Capture with Hand Management

Position with pieces in hand (FEEN):

lnsgkgsnl/1r5b1/ppppppppp/9/9/2P6/PP1PPPPPP/1B5R1/LNSGKGSNL B/ shogi/SHOGI

PAN Moves:

c4xb4      # Capture enemy piece
*g5        # Drop from hand
f6*        # Capture to hand

Edge Cases and Validation

Valid PAN Strings

# Minimal valid moves
a1-a2      # Shortest move
*a         # Shortest placement (1D board)
z*         # Shortest capture-to-reserve (1D board)

# Maximum complexity (within CELL limits)
aa1Aaa-bb2Bbb   # Complex multi-dimensional movement
*zz26Czz        # Complex placement
yy25Byy*        # Complex capture-to-reserve

Invalid PAN Strings

# Syntax errors
e2-         # Missing destination
xe4         # Missing source for capture
--e4        # Double operator
e2-e2       # Source equals destination

# Format errors
E2-e4       # Invalid CELL format (uppercase number position)
e2- e4      # Space in move string
e2→e4       # Wrong operator character

# Logic errors (context-dependent)
*e4         # Invalid if e4 occupied
e4-e5       # Invalid if e4 empty or e5 occupied
e4xe5       # Invalid if e5 empty
e4*         # Invalid if e4 empty

Implementation Patterns

Parsing Examples

# Ruby parsing pattern
def parse_pan(move_string)
  case move_string
  when /\A([a-z]+(?:[1-9]\d*[A-Z]+[a-z]+)*(?:[1-9]\d*(?:[A-Z]+)?)?)([x-])([a-z]+(?:[1-9]\d*[A-Z]+[a-z]+)*(?:[1-9]\d*(?:[A-Z]+)?)?)\z/
    { type: :move_or_capture, source: $1, operator: $2, destination: $3 }
  when /\A\*([a-z]+(?:[1-9]\d*[A-Z]+[a-z]+)*(?:[1-9]\d*(?:[A-Z]+)?)?)\z/
    { type: :placement, destination: $1 }
  when /\A([a-z]+(?:[1-9]\d*[A-Z]+[a-z]+)*(?:[1-9]\d*(?:[A-Z]+)?)?)\*\z/
    { type: :capture_to_reserve, source: $1 }
  else
    nil  # Invalid format
  end
end

Validation Examples

# Ruby validation pattern
def validate_pan(move_string, board_state)
  parsed = parse_pan(move_string)
  return false unless parsed

  case parsed[:type]
  when :move_or_capture
    validate_board_to_board_move(parsed, board_state)
  when :placement
    validate_placement_move(parsed, board_state)
  when :capture_to_reserve
    validate_capture_to_reserve_move(parsed, board_state)
  end
end

Best Practices

When to Use Each Move Type

Simple moves (-):

Captures (x):

Placements (*destination):

Capture-to-reserve (source*):

Documentation Guidelines

  1. Specify coordinate system: Document CELL coordinate interpretation
  2. Define board boundaries: Clarify valid coordinate ranges
  3. Explain capture mechanics: Document what happens to captured pieces
  4. Provide context requirements: Specify what external information is needed
  5. Include validation rules: Document game-specific move validation

Integration Examples

With PMN (Portable Move Notation)

PAN can represent the spatial aspect of PMN actions:

PMN: ["e2", "e4", "CHESS:P"] PAN: e2-e4

PMN: ["e4", "d5", "CHESS:P", "d5", "*", "chess:p"] PAN: e4xd5 (spatial representation only)

With GGN (General Gameplay Notation)

PAN moves should correspond to valid GGN possibilities:

GGN possibility (simplified):

{
  "CHESS:P": {
    "e2": {
      "e4": [{"must": {"e3": "empty", "e4": "empty"}}]
    }
  }
}

Valid PAN: e2-e4


Conclusion

PAN provides a compact, rule-agnostic notation system for representing the spatial aspects of moves across diverse board game systems. By leveraging CELL and HAND specifications, PAN achieves universal applicability while maintaining simplicity and efficiency.

The examples in this document demonstrate PAN’s versatility across traditional 2D games, multi-dimensional variants, and games with capture-and-drop mechanics, making it suitable for a wide range of abstract strategy games.

For the complete technical specification, consult the PAN Specification v1.0.0.