Ruby solution to John Conway's 'Life' celullar automaton.
- Any live cell with <2 live neighbours perishes.
- Any live cell with 2 || 3 live neighbours lives.
- Any live cell with >3 live neighbours perishes.
- Any dead cell with == 3 live neighbours comes alive.
require and specify
>$ irb
2.7.0 :001 > require './path_to_file/pattern.rb'
2.7.0 :002 > require './path_to_file/board.rb'
2.7.0 :003 > require './path_to_file/cell.rb'
2.7.0 :004 > require './path_to_file/game.rb'
2.7.0 :005 > game = Game.new
set start pattern loaf, toad and test are valid
>$
2.7.0 :006 > game.condition('test')
run with period n
>$
2.7.0 :007 > game.start(n)
Using rspec
and simplecov
for coverage
>$ rspec
As a Developer,
To pay homage to the late Conway,
I would like to recreate the Game of Life.
As a Cell,
To be able to exist in my world,
I can detect the state of cells around me.
As a User,
To be able to interact with the game,
I can choose my starting conditions.
As a Cell,
To be able to grow,
I switch off if I have 3 live neighbours.
As a Cell,
To be able to perish,
I would like to switch off If I have more than 3; or less than 2 neighbours.
As a User,
So I can experiment,
I would like to upload grid configurations to the application.
As a User,
To be able to see the game,
I would like to visualise results in a command line interface.