module FEEN
Overview
This module provides a Ruby interface for data serialization and deserialization in FEEN format.
@see https://developer.sashite.com/specs/forsyth-edwards-expanded-notation
Defined in:
feen.crfeen/dumper.cr
feen/dumper/in_hand.cr
feen/dumper/square.cr
feen/dumper/turn.cr
feen/parser.cr
feen/parser/in_hand.cr
feen/parser/shape.cr
feen/parser/square.cr
feen/parser/turn.cr
Constant Summary
-
VERSION =
"0.1.0"
Class Method Summary
-
.dump(*, in_hand, shape, side_id, square = {} of Int32 => String)
@example Dumps position params into a FEEN string.
-
.parse(feen)
Parses a FEEN string into position params.
Class Method Detail
@example Dumps position params into a FEEN string.
@param in_hand [Array] The list of pieces in hand. @param shape [Array] The shape of the board. @param side_id [Integer] The identifier of the player who must play. @param square [Hash] The index of each piece on the board.
@example Dump a classic Tsume Shogi problem dump( "in_hand": %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], "shape": [9, 9], "side_id": 0, "square": { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } )
=> "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s"
@return [String] The FEEN string representing the position.
Parses a FEEN string into position params.
@param feen [String] The FEEN string representing a position.
@example Parse a classic Tsume Shogi problem parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s")
=> {
"in_hand": ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"],
"shape": [9, 9],
"side_id": 0,
"square": {
3 => "s",
4 => "k",
5 => "s",
22 => "+P",
43 => "+B"
}
@return [Hash] The position params representing the position.