]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / examples / stories / game-of-life / life / game.rb
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