Module: Sashite::Feen::Parser::StyleTurn Private
- Defined in:
- lib/sashite/feen/parser/style_turn.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Parser for FEEN Style-Turn field (Field 3).
The Style-Turn field encodes:
-
The native Piece Style associated with each Player Side
-
The identity of the Active Player
Format:
<ACTIVE-STYLE>/<INACTIVE-STYLE>
Where each STYLE is a valid SIN token (exactly one ASCII letter).
Side attribution (by case):
-
Uppercase (A-Z): Player Side
first -
Lowercase (a-z): Player Side
second
Turn attribution (by position):
-
Left of
/: Active Player -
Right of
/: Inactive Player
Class Method Summary collapse
-
.parse(input) ⇒ Hash
private
Parses a FEEN Style-Turn field string.
Class Method Details
.parse(input) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses a FEEN Style-Turn field string.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sashite/feen/parser/style_turn.rb', line 47 def self.parse(input) validate_delimiter!(input) active_str, inactive_str = input.split(Constants::SEGMENT_SEPARATOR, -1) active = parse_style(active_str) inactive = parse_style(inactive_str) validate_opposite_case!(active, inactive) { active: active, inactive: inactive } end |