conway_deathmatch 0.1.0.1 → 0.1.0.2

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: 1ec817b0ebbe212baa79e891508aa3bfaba1998b
4
- data.tar.gz: 7d83ba811e828012a658ea222a21bf5818bb0636
3
+ metadata.gz: d1e28000746a34583e9e6440c5212c71f3d76612
4
+ data.tar.gz: 8c9c94648fcb1ce681c239f2f77992b9b26b5135
5
5
  SHA512:
6
- metadata.gz: c14fc7490abed86aca69a95b50c5205becf541b15bbcf53e2d1678b7c1ff82b751aa5a083f867de4d833c21cd9605b31f8d4150a07fd323b00f5fe01590d5022
7
- data.tar.gz: eeccd888a4c1d73621259e7cf11e540de2cd8c0f036e69dc8b3b309ab2fcc7f0599b9426d9956cc78d264a2b40dc2a85f383b7cbbb9cc6d0870d5d431f6ff26f
6
+ metadata.gz: c40b259c8a5ae552296ba668a535c9ca50be3348867df9ef1db79a7029339a75582156d5d33a681d21ca43cb39249515ec0cefeaf7cbef48a8caf9824a9012a3
7
+ data.tar.gz: 7949a6e90a5648a74ec6034dc6e5be9ab02b06e5207dac3ed7e21308f866f11aa7e85a5c4ab35d6c8f9df25aa871d4bc0a04ced4a5a0dbd821062345601415de
@@ -67,7 +67,7 @@ class ConwayDeathmatch::BoardState
67
67
  neighbors
68
68
  end
69
69
 
70
- # multiplayer, neighbor count and birthright
70
+ # total (alive) neighbor count and birthright
71
71
  def neighbor_stats(x, y)
72
72
  if @multiplayer
73
73
  total = 0
@@ -1,35 +1,31 @@
1
1
  require 'conway_deathmatch/board_state'
2
2
  require 'yaml'
3
3
 
4
- module ConwayDeathmatch
5
- module Shapes
6
- @@known
7
-
8
- # memoize data/shapes.yaml
9
- def self.known
10
- @@known ||= YAML.load_file(File.join(__dir__, 'data', 'shapes.yaml'))
11
- end
12
-
13
- # parse a string like "acorn 12 22 block 5 0 p 1 2 p 3 4 p 56 78"
14
- # add known shapes
15
- def self.add(board, str, val = BoardState::ALIVE)
16
- tokens = str.split
17
- points = []
18
- known = self.known
19
-
20
- while !tokens.empty?
21
- shape = tokens.shift.downcase
22
- raise "no coordinates for #{shape}" if tokens.length < 2
23
- x = tokens.shift.to_i
24
- y = tokens.shift.to_i
25
- case shape.downcase
26
- when 'p'
27
- points << [x, y]
28
- else
29
- board.add_points(known.fetch(shape), x, y, val)
30
- end
4
+ module ConwayDeathmatch::Shapes
5
+ # memoize data/shapes.yaml
6
+ def self.known
7
+ @@known ||= YAML.load_file(File.join(__dir__, 'data', 'shapes.yaml'))
8
+ end
9
+
10
+ # parse a string like "acorn 12 22 block 5 0 p 1 2 p 3 4 p 56 78"
11
+ # add known shapes
12
+ def self.add(board, str, val = BoardState::ALIVE)
13
+ tokens = str.split
14
+ points = []
15
+ known = self.known
16
+
17
+ while !tokens.empty?
18
+ shape = tokens.shift.downcase
19
+ raise "no coordinates for #{shape}" if tokens.length < 2
20
+ x = tokens.shift.to_i
21
+ y = tokens.shift.to_i
22
+ case shape.downcase
23
+ when 'p'
24
+ points << [x, y]
25
+ else
26
+ board.add_points(known.fetch(shape), x, y, val)
31
27
  end
32
- board.add_points(points, 0, 0, val)
33
28
  end
29
+ board.add_points(points, 0, 0, val)
34
30
  end
35
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conway_deathmatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.1
4
+ version: 0.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Hull