lifegame 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2e80d6b2927a69ed97a8e142a7538ce1ddd4011b22dd4d781a15952cc93f151
4
- data.tar.gz: f61309c22f99c50799a74137f37ed49dd3f2bf38ea891c283a9acdff9a473d6c
3
+ metadata.gz: c6210ba3f836642e848b1c8b9cdedc17899c8ae46d0a234cd7a28fecb8d57183
4
+ data.tar.gz: e199e78a093866842dd94e59f7bb45dccf891833fd8e44f18a7bd8f3e60953dd
5
5
  SHA512:
6
- metadata.gz: 546c342f21ee880a8272508e69781e0bb57705395ababddbcbe03ecb5bebe0f15d38b39265a287afd61f7a93b2c3c2925ca7f8202f53ccc96fe12fafdee66619
7
- data.tar.gz: '05945e3ef8b12b9a4259121786eec24988e115445e6a5ed17b9b2817af6b4a6e94e30c4d5c0a1c7c211d177759807085888d1f516336ec25fabda0c627a4da38'
6
+ metadata.gz: 451f6ed098b7742205bc804ba6895ea2e13b022dae6aedea88e1023b3ab195359c3920f6641a51a2f00c8b5e4987f2d6b0b1029fccbca85549482e6ad6699952
7
+ data.tar.gz: 37f6cb69600a57cd8ef71aa84548173d14710bc3eb565ce8f0fc13e407df484e6f10a9806b7a1ce50f2b7cd60c88a33cc465dbe51f09a3cb87674ae82043266d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lifegame (0.1.1)
4
+ lifegame (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -29,7 +29,7 @@ $ gem install lifegame
29
29
 
30
30
  ```ruby
31
31
  # 20 x 50
32
- game = Lifegame::Lifegame.new(20, 50)
32
+ game = Lifegame::Game.new(20, 50)
33
33
 
34
34
  # eg: grader
35
35
  game[2,7].be!; game[2,8].be!; game[2,9].be!; game[1,7].be!; game[0,8].be!
@@ -49,6 +49,12 @@ game.sow!(0.2)
49
49
  game.start
50
50
  ```
51
51
 
52
+ or on your shell
53
+
54
+ ```sh
55
+ $ lifegame
56
+ ```
57
+
52
58
  ## License
53
59
 
54
60
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/demo CHANGED
@@ -3,6 +3,6 @@
3
3
  require "bundler/setup"
4
4
  require "lifegame"
5
5
 
6
- game = Lifegame::Lifegame.new((ARGV[0] || 20).to_i, (ARGV[1] || 50).to_i)
6
+ game = Lifegame::Game.new((ARGV[0] || 20).to_i, (ARGV[1] || 50).to_i)
7
7
  game.sow!((ARGV[2] || 0.2).to_f)
8
8
  game.start
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'lifegame'
4
+
5
+ x = (ARGV[0] || 20).to_i
6
+ y = (ARGV[1] || 50).to_i
7
+ frequency = (ARGV[2] || 0.2).to_f
8
+
9
+ game = Lifegame::Game.new(x, y)
10
+ game.sow!(frequency)
11
+ game.start
@@ -1,5 +1,5 @@
1
1
  require "lifegame/version"
2
- require "lifegame/lifegame"
2
+ require "lifegame/game"
3
3
  require "lifegame/life"
4
4
 
5
5
  module Lifegame
@@ -1,7 +1,7 @@
1
1
  require_relative "./life"
2
2
 
3
3
  module Lifegame
4
- class Lifegame
4
+ class Game
5
5
  include Enumerable
6
6
 
7
7
  def initialize(x, y)
@@ -1,11 +1,14 @@
1
1
  module Lifegame
2
2
  class Life
3
+ ALIVE = '-'
4
+ DEAD = '_'
5
+
3
6
  def initialize(life = false)
4
7
  @life = life
5
8
  end
6
9
 
7
10
  def to_s
8
- alive? ? '.' : '-'
11
+ alive? ? ALIVE : DEAD
9
12
  end
10
13
 
11
14
  def alive?
@@ -1,3 +1,3 @@
1
1
  module Lifegame
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifegame
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - oieioi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-21 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -55,7 +55,8 @@ dependencies:
55
55
  description: Conway's Game of Life
56
56
  email:
57
57
  - atsuinatsu.samuifuyu@gmail.com
58
- executables: []
58
+ executables:
59
+ - lifegame
59
60
  extensions: []
60
61
  extra_rdoc_files: []
61
62
  files:
@@ -72,9 +73,10 @@ files:
72
73
  - bin/demo
73
74
  - bin/setup
74
75
  - demo.gif
76
+ - exe/lifegame
75
77
  - lib/lifegame.rb
78
+ - lib/lifegame/game.rb
76
79
  - lib/lifegame/life.rb
77
- - lib/lifegame/lifegame.rb
78
80
  - lib/lifegame/version.rb
79
81
  - lifegame.gemspec
80
82
  homepage: https://github.com/oieioi/lifegame.rb