Module: Sashite::Pnn
- Defined in:
- lib/sashite/pnn.rb,
lib/sashite/pnn/piece.rb
Overview
PNN (Piece Name Notation) implementation for Ruby
Provides style-aware ASCII-based format for representing pieces in abstract strategy board games. PNN extends PIN by adding derivation markers that distinguish pieces by their style origin, enabling cross-style game scenarios and piece origin tracking.
Format: [<state>]<letter>
-
State modifier: “+” (enhanced), “-” (diminished), or none (normal)
-
Letter: A-Z (first player), a-z (second player)
-
Derivation marker: “‘” (foreign style), or none (native style)
Examples:
"K" - First player king (native style, normal state)
"k'" - Second player king (foreign style, normal state)
"+R'" - First player rook (foreign style, enhanced state)
"-p" - Second player pawn (native style, diminished state)
Defined Under Namespace
Classes: Piece
Class Method Summary collapse
-
.parse(pnn_string) ⇒ Pnn::Piece
Parse a PNN string into a Piece object.
-
.piece(type, side, state = Sashite::Pin::Piece::NORMAL_STATE, native = Piece::NATIVE) ⇒ Pnn::Piece
Create a new piece instance.
-
.valid?(pnn_string) ⇒ Boolean
Check if a string is a valid PNN notation.
Class Method Details
.parse(pnn_string) ⇒ Pnn::Piece
Parse a PNN string into a Piece object
49 50 51 |
# File 'lib/sashite/pnn.rb', line 49 def self.parse(pnn_string) Piece.parse(pnn_string) end |
.piece(type, side, state = Sashite::Pin::Piece::NORMAL_STATE, native = Piece::NATIVE) ⇒ Pnn::Piece
Create a new piece instance
65 66 67 |
# File 'lib/sashite/pnn.rb', line 65 def self.piece(type, side, state = Sashite::Pin::Piece::NORMAL_STATE, native = Piece::NATIVE) Piece.new(type, side, state, native) end |