conway_deathmatch 0.0.0.6 → 0.1.0.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 +4 -4
- data/bin/conway_deathmatch +1 -1
- data/lib/conway_deathmatch/board_state.rb +7 -2
- data/lib/conway_deathmatch/shapes.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ec817b0ebbe212baa79e891508aa3bfaba1998b
|
4
|
+
data.tar.gz: 7d83ba811e828012a658ea222a21bf5818bb0636
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c14fc7490abed86aca69a95b50c5205becf541b15bbcf53e2d1678b7c1ff82b751aa5a083f867de4d833c21cd9605b31f8d4150a07fd323b00f5fe01590d5022
|
7
|
+
data.tar.gz: eeccd888a4c1d73621259e7cf11e540de2cd8c0f036e69dc8b3b309ab2fcc7f0599b9426d9956cc78d264a2b40dc2a85f383b7cbbb9cc6d0870d5d431f6ff26f
|
data/bin/conway_deathmatch
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module ConwayDeathmatch; end # create namespace
|
2
2
|
|
3
3
|
# data structure for the board - 2d array
|
4
4
|
# implements standard and multiplayer evaluation
|
5
5
|
# static boundaries are treated as dead
|
6
6
|
#
|
7
|
-
class
|
7
|
+
class ConwayDeathmatch::BoardState
|
8
8
|
class BoundsError < RuntimeError; end
|
9
9
|
|
10
10
|
DEAD = '.'
|
@@ -36,6 +36,11 @@ class ConwayGame::BoardState
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def value(x, y)
|
40
|
+
in_bounds!(x,y)
|
41
|
+
@state[x][y].dup
|
42
|
+
end
|
43
|
+
|
39
44
|
def in_bounds?(x, y)
|
40
45
|
@xr.include?(x) and @yr.include?(y)
|
41
46
|
end
|