conway_deathmatch 0.3.1.1 → 0.3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74cb09c10b150b79fde2d90b7ec9f19ba734ea45
4
- data.tar.gz: afab5401c02eacf4f0fdbcba7635248d030e77ac
3
+ metadata.gz: 663e9b6405e76fd879785618712abf237c93d9e7
4
+ data.tar.gz: afba97a81f9e8c6fc1a919dd97345f191d4c6162
5
5
  SHA512:
6
- metadata.gz: 9bd27fa170687568717234356174f09cf3fc57fbb20e2516c46cdad921a81b6db4c78983a976b553afc3f496ca05091d4ccd0264187542a7b70b621ccce4d24f
7
- data.tar.gz: dafed28ce3008911055047b5ca22aaeb3b049b5735965542f6ee156d4a22c78c03ae194546dcc48f0efcded14af0066bdafe0ded84e88de33e1e861d1bae2ff8
6
+ metadata.gz: ca9c400efcca67c00b6db2a603de8134ce8e6d873e27582b9237c62d81977a35ed9f2ab0108c7c154f501531a295ebf8e986e5e3bfef4a947071c0aa26790b91
7
+ data.tar.gz: c590e7b045a8a427c985380a8060a0f7bf0c9bb7190a5d8032587df4ed5352c628d452fb439aeb7e3895418c1baaa2cf666a9fec1201a894b01f3fefd1369c88
@@ -53,14 +53,14 @@ class ConwayDeathmatch::BoardState
53
53
  @state[x][y] != DEAD rescue false
54
54
  end
55
55
 
56
- # population of each neighbor
56
+ # population of every neighboring entity, including DEAD
57
57
  def neighbor_population(x, y)
58
- outer_ring = x == 0 or y == 0 or x == @x_len - 1 or y == @y_len - 1
58
+ outer_ring = (x == 0 or y == 0 or x == @x_len - 1 or y == @y_len - 1)
59
59
  neighbors = Hash.new(0)
60
60
  (x-1..x+1).each { |xn|
61
- next if outer_ring and xn < 0 or xn >= @x_len
61
+ next if outer_ring and !xn.between?(0, @x_len - 1)
62
62
  (y-1..y+1).each { |yn|
63
- next if outer_ring and yn < 0 or yn >= @y_len
63
+ next if outer_ring and !yn.between?(0, @y_len - 1)
64
64
  next if xn == x and yn == y # don't count self
65
65
  neighbors[@state[xn][yn]] += 1
66
66
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conway_deathmatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.1
4
+ version: 0.3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Hull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-02 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: buildar
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
27
41
  description: Deathmatch
28
42
  email:
29
43
  executables: