Module: Sashite::Feen::Parser::PiecesInHand
- Defined in:
- lib/sashite/feen/parser/pieces_in_hand.rb
Overview
Parser for the pieces-in-hand field (second field of FEEN).
Converts a FEEN pieces-in-hand string into a Hands object, decoding captured pieces held by each player with optional count prefixes.
Constant Summary collapse
- PLAYER_SEPARATOR =
Player separator in pieces-in-hand field.
"/"- EPIN_PATTERN =
Pattern to match EPIN pieces (optional state prefix, letter, optional derivation suffix).
/\A[-+]?[A-Za-z]'?\z/
Class Method Summary collapse
-
.parse(string) ⇒ Hands
Parse a FEEN pieces-in-hand string into a Hands object.
Class Method Details
.parse(string) ⇒ Hands
Parse a FEEN pieces-in-hand string into a Hands object.
41 42 43 44 45 46 47 48 |
# File 'lib/sashite/feen/parser/pieces_in_hand.rb', line 41 def self.parse(string) first_str, second_str = split_players(string) first_player_pieces = parse_player_pieces(first_str) second_player_pieces = parse_player_pieces(second_str) Hands.new(first_player_pieces, second_player_pieces) end |