class Sashite::Cpn::Generate
Main class.
Public Class Methods
new(bool, indexes, squares, pieces)
click to toggle source
@param bool [Boolean] The turn to play. @param indexes [Array] The shape of the board. @param squares [Array] The board structure. @param pieces [Array] The list of pieces in hand.
# File lib/sashite/cpn.rb, line 25 def initialize(bool, indexes, squares, pieces) fail LengthError unless indexes.inject(:*).to_i.equal?(squares.length) @turn = Turn.new(bool) @shape = Shape.new(*indexes) @position = Position.new(*squares) @pieces_in_hand = PiecesInHand.new(*pieces) end
Public Instance Methods
to_s()
click to toggle source
@return [String] A CPN string.
# File lib/sashite/cpn.rb, line 35 def to_s [ @turn.to_s, @shape.to_s, @position.to_s, @pieces_in_hand.to_s ].join('--') end