Module: Sashite::Feen::Dumper::PiecesInHand
- Defined in:
- lib/sashite/feen/dumper/pieces_in_hand.rb
Overview
Dumper for the pieces-in-hand field (second field of FEEN).
Converts a Hands object into its FEEN string representation, encoding captured pieces held by each player in canonical sorted order.
Constant Summary collapse
- PLAYER_SEPARATOR =
Player separator in pieces-in-hand field.
"/"
Class Method Summary collapse
-
.dump(hands) ⇒ String
Dump a Hands object into its FEEN pieces-in-hand string.
Class Method Details
.dump(hands) ⇒ String
Dump a Hands object into its FEEN pieces-in-hand string.
Generates canonical representation with pieces sorted according to FEEN ordering rules: by quantity (descending), base letter (ascending), case (uppercase first), prefix (-, +, none), and suffix (none, ‘).
36 37 38 39 40 41 |
# File 'lib/sashite/feen/dumper/pieces_in_hand.rb', line 36 def self.dump(hands) first_player_str = dump_player_pieces(hands.first_player) second_player_str = dump_player_pieces(hands.second_player) "#{first_player_str}#{PLAYER_SEPARATOR}#{second_player_str}" end |