Module: Sashite::Gan
- Defined in:
- lib/sashite/qpi.rb,
lib/sashite/qpi/actor.rb
Overview
GAN (General Actor Notation) implementation for Ruby
Provides a rule-agnostic format for identifying game actors in abstract strategy board games by combining Style Name Notation (SNN) and Piece Identifier Notation (PIN) with a colon separator and consistent case encoding.
GAN represents all four fundamental piece attributes from the Game Protocol:
-
Type → PIN component (ASCII letter choice)
-
Side → Consistent case encoding across both SNN and PIN components
-
State → PIN component (optional prefix modifier)
-
Style → SNN component (explicit style identifier)
Format: <snn>:<pin>
-
SNN component: Style identifier with case-based side encoding
-
Colon separator: Literal “:”
-
PIN component: Piece with optional state and case-based ownership
-
Case consistency: SNN and PIN components must have matching case
Examples:
"CHESS:K" - First player chess king
"chess:k" - Second player chess king
"SHOGI:+P" - First player enhanced shōgi pawn
"xiangqi:-g" - Second player diminished xiangqi general
Defined Under Namespace
Classes: Actor
Class Method Summary collapse
-
.actor(name, type, side, state = :normal) ⇒ Gan::Actor
Create a new actor instance.
-
.parse(gan_string) ⇒ Gan::Actor
Parse a GAN string into an Actor object.
-
.valid?(gan_string) ⇒ Boolean
Check if a string is valid GAN notation.
Class Method Details
.actor(name, type, side, state = :normal) ⇒ Gan::Actor
Create a new actor instance
72 73 74 |
# File 'lib/sashite/qpi.rb', line 72 def self.actor(name, type, side, state = :normal) Actor.new(name, type, side, state) end |
.parse(gan_string) ⇒ Gan::Actor
Parse a GAN string into an Actor object
57 58 59 |
# File 'lib/sashite/qpi.rb', line 57 def self.parse(gan_string) Actor.parse(gan_string) end |