class GooseGame::GameBoard

Constants

BRIDGE_CELLS
GOOSE_CELLS
WINNING_CELLS

Public Instance Methods

[](n) click to toggle source
# File lib/goose_game/gameboard.rb, line 9
def [](n)
  cells.fetch(n) { Cell::Bounce.new(n, self) }
end
cells() click to toggle source
# File lib/goose_game/gameboard.rb, line 13
def cells
  @cells ||= (0..FINISH).reduce({}) { |acc, n| acc[n] = Cell::Base.new(n, self); acc }.tap do |cells|
    WINNING_CELLS.each { |n| cells[n] = Cell::Winning.new(n, self) }
    BRIDGE_CELLS.each { |n| cells[n] = Cell::Bridge.new(n, self) }
    GOOSE_CELLS.each { |n| cells[n] = Cell::Goose.new(n, self) }
  end
end