As a fan of games, I want to model Convoy's game of life, with game starting from initial life state so that I can return state of life after each iteration.
- Any live cell with fewer than two live neighbours dies, as if by underpopulation.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overpopulation.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Add this line to your application's Gemfile:
gem 'gameoflife'
And then execute:
bundle
Or install it yourself as:
gem install gameoflife
- Throws error when memory limit exceeded.
- RVM or RBENV. See respective website for installation instructions.
- Bundler (>= 2.0.1). Install using
gem install bundler
After checking out the repo,
- Run
rvm use
orrbenv local
to switch to the configured Ruby version for this project. - Run
bundle install --path vendor/bundle
to install dependencies.
- Run
ruby lib/gameoflife/application.rb
Input Instructions :
- Either use predefined patterns or custom input as follows
First input number (N) of live cells initially. Next N Lines, enter zero indexed row and column of live cells. Enter how many iterations(X) you want to view ?
To install this gem onto your local machine, run bundle exec rake install
.