Module: PortableMoveNotation
- Defined in:
- lib/portable_move_notation.rb,
lib/portable_move_notation/move.rb,
lib/portable_move_notation/action.rb
Overview
Portable Move Notation module
PMN v1.0.0 implementation providing rule-agnostic representation of state-changing actions in abstract strategy board games.
This implementation follows the PMN v1.0.0 specification which uses an array-of-arrays format: each action is a 4-element array containing [source_square, destination_square, piece_name, captured_piece].
Defined Under Namespace
Constant Summary collapse
- SCHEMA_URL =
Schema URL for validation
"https://sashite.dev/schemas/pmn/1.0.0/schema.json"
Class Method Summary collapse
-
.generate(move) ⇒ String
Generate PMN JSON from a Move object.
-
.parse(json_string) ⇒ Move
Parse PMN JSON string into a Move object.
-
.valid?(pmn_data) ⇒ Boolean
Quick validation method for PMN data.
Class Method Details
.generate(move) ⇒ String
Generate PMN JSON from a Move object
40 41 42 |
# File 'lib/portable_move_notation.rb', line 40 def self.generate(move) move.to_json end |