Method: Board.from_a

Defined in:
lib/command_four/board.rb

.from_a(arr, connect_n = 4) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/command_four/board.rb', line 50

def self.from_a(arr, connect_n = 4)
  board = Board.new(arr.length, arr[0].length, connect_n)
  for i in 0...arr[0].length
    for j in 0...arr.length
      if arr[j][i] != :empty
        board.drop_piece(j, arr[j][i])
      end
    end
  end
  board
end