repo.or.cz
/
monkeycharger.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Upgraded Rails and RSpec
[monkeycharger.git]
/
vendor
/
plugins
/
rspec
/
rspec
/
examples
/
stories
/
game-of-life
/
life
/
game.rb
blob
5411b01bf1616f4c76186bf1e59d9d536f54fb3c
1
class Game
2
attr_accessor :grid
3
def initialize(rows,cols)
4
@grid = Grid.new(rows, cols)
5
end
6
7
def create_at(row,col)
8
@grid.create_at(row,col)
9
end
10
11
def destroy_at(row,col)
12
@grid.destroy_at(row, col)
13
end
14
15
def self.from_string(dots)
16
grid = Grid.from_string(dots)
17
game = new(grid.rows, grid.columns)
18
game.instance_eval do
19
@grid = grid
20
end
21
return game
22
end
23
end