class FEEN::Parser::Square

Overview

The square class.

@example Parse a Shogi problem board and return an array Board.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_a

=> [

nil, nil, nil, "s", "k", "s", nil, nil, nil,

nil, nil, nil, nil, nil, nil, nil, nil, nil,

nil, nil, nil, nil, "+P", nil, nil, nil, nil,

nil, nil, nil, nil, nil, nil, nil, nil, nil,

nil, nil, nil, nil, nil, nil, nil, "+B", nil,

nil, nil, nil, nil, nil, nil, nil, nil, nil,

nil, nil, nil, nil, nil, nil, nil, nil, nil,

nil, nil, nil, nil, nil, nil, nil, nil, nil,

nil, nil, nil, nil, nil, nil, nil, nil, nil

]

@example Parse a Shogi problem board and return a hash Board.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_h

=> {

3 => "s",

4 => "k",

5 => "s",

22 => "+P",

43 => "+B"

}

Defined in:

feen/parser/square.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(board : String) #

@param board [String] The flatten board.


[View source]

Instance Method Detail

def to_a #

@return [Array] The list of squares on the board.


[View source]
def to_h #

@return [Hash] The index of each piece on the board.


[View source]