Class: RubyLife::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_life/game.rb

Instance Method Summary collapse

Constructor Details

#initializeGame

Returns a new instance of Game.



3
4
5
# File 'lib/ruby_life/game.rb', line 3

def initialize
  @grid = Grid.new(40)
end

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby_life/game.rb', line 7

def run
  clear_screen

  i = 0
  loop do
    puts "generation #{i}"
    puts @grid
    @grid.generate!
    animate_transition
    i += 1
  end
end