Sha256: 726b9fbb77ff48e11b891d29dba8575941dc70b72aea308a557a0cd708b74cc4

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/setup"
require "game_of_life"

error = false

if ARGV.length < 1
  puts 'please provide width:value height:value seed_probability:value'
  puts 'Try running'
  puts 'conways_game_of_life width:3 height:3 seed_probability:true'
else
  ARGV.each do |arg|
    argument = arg.split(':')
    next if argument.length < 2
    unless %w(width height seed_probability speed).include? argument[0]
      puts "Invalid option #{argument[0]}"
      error = true
    end
    eval("@#{argument[0]}=#{argument[1]}")
  end

  if error
    puts 'Valid options are width:value height:value seed_probability:value'
  else
    GameOfLife::Cli.start(@width, @height, @seed_probability, @speed)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conways_game_of_life-1.0.3 bin/game_of_life
conways_game_of_life-1.0.2 bin/game_of_life