Class: Sashite::Cpn::Generate
- Inherits:
-
Object
- Object
- Sashite::Cpn::Generate
- Defined in:
- lib/sashite/cpn.rb
Overview
Main class.
Instance Method Summary collapse
-
#initialize(bool, indexes, squares, pieces) ⇒ Generate
constructor
A new instance of Generate.
-
#to_s ⇒ String
A CPN string.
Constructor Details
#initialize(bool, indexes, squares, pieces) ⇒ Generate
Returns a new instance of Generate.
25 26 27 28 29 30 31 32 |
# 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 |
Instance Method Details
#to_s ⇒ String
Returns A CPN string.
35 36 37 38 39 40 41 42 |
# 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 |