GameOfLife

The implementation of the Conway's Game of Life ruby CLI gem

Installation

$ gem install terminal_game_of_life

Usage

$game-of-life -i https://example.com --live-cell +
$game-of-life -i /path/to/file.txt --height 35 --width 35
$game-of-life -s 1337 --delay 250

Check game-of-life --help for usage info.

Commands:
  game-of-life --version, -v    # Prints the Game of Life version information
  game-of-life help [COMMAND]   # Describe available commands or one specific command
  game-of-life start [OPTIONS]  # Start the Game of Life simulations

Options:
  -s, [--seed=SEED]            # Specify the seed number to use as an initial state (default to random).
  -i, [--input=VALUE]          # Specify the path/URL for the file to use as an initial state. (used instead of seed)
      [--width=WIDTH]          # Specify the width of generated universe. (default to terminal width)
      [--height=HEIGHT]        # Specify the hight of generated universe. (default to terminal height)
      [--dead-cell=CHAR]       # Specify the dead-cell representation
                               # Default:  
      [--live-cell=CHAR]       # Specify the live-cell representation
                               # Default: █
  -d, [--delay=Milli-Seconds]  # Specify the introduced delay between each generation
                               # Default: 50

Demo

asciicast

Development

Locally

  • Clone the repo.
  • Navigate to the ruby CLI implementation cd game-of-life/CLI/ruby.
  • run bundle install to install dependencies.
  • you can run bundle exec rake build to build the gem/CLI into the pkg directory.
  • you can run bundle exec rake install to build and install gem/CLI into system gems.
  • you can run bundle exec ./bin/game-of-life to run the code for development/testing purposes

Docker

  • Run docker build . -t ruby-gol
  • Run docker run -it -v .:/app ruby-gol bundle exec rake install
  • Run docker run -it ruby-gol

Linting

Run bundle exec rubocop or docker run -it -v .:/app ruby-gol bundle exec rubocop

Testing

Run bundle exec rspec or docker run -it ruby-gol bundle exec rspec

Documentation

Run bundle exec yard or docker run -it -v .:/app ruby-gol bundle exec yard

Release

  • Update the version number
  • Run bundle install and commit changes (or docker run -it -v .:/app ruby-gol bundle install)
  • Update the CHANGELOG
  • Create a git tag ruby/v#{version_number} ex: ruby/v0.1.1-pre

The tag will automatically trigger the release workflow after successful build/test and release the changes to rubygems.org

Extra information

Contributing

License

Code of Conduct