gameboard 3.0.0 → 3.1.0
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/lib/gameboard/board.rb +11 -0
- data/lib/gameboard/version.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: c69058dab994bf5c71099b639fc8d04e08ed0dbb
|
4
|
+
data.tar.gz: 18f2625a97889bc391ba3e25cd71f16487e8fdfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d872aa7e94b2811b826977755b24731ed122939a401401bc6ac8b45d991867361294471a894d9b1a73c0475566854e8b773ff8590138f1fdee616f98488dec15
|
7
|
+
data.tar.gz: e7425984d29c04430920639e48c027e6b38e677ea09c79f5963d8b05c596b914e5ee8d37ab38b8870c192182cd4cfb706360ccaf800e41f3913dda594eb34f40
|
data/lib/gameboard/board.rb
CHANGED
@@ -338,6 +338,15 @@ module Gameboard
|
|
338
338
|
end
|
339
339
|
end
|
340
340
|
|
341
|
+
# Public: Set a cells value at a given coordinate
|
342
|
+
#
|
343
|
+
# coord - A coordinate pair in the form X, Y
|
344
|
+
def set_cell(coord, value)
|
345
|
+
cell = find_cell(coord)
|
346
|
+
raise "Cell Not Found" unless !!cell
|
347
|
+
cell.value = value
|
348
|
+
end
|
349
|
+
|
341
350
|
# Public: Return every column on the gameboard.
|
342
351
|
#
|
343
352
|
# coords: An optional boolean to specify returning an Array of coordinates
|
@@ -384,6 +393,8 @@ module Gameboard
|
|
384
393
|
# Internal: Returns the default gameboard cell value
|
385
394
|
attr_reader :cells
|
386
395
|
|
396
|
+
# Internal: return a diagonal array given a starting point and a
|
397
|
+
# slope.
|
387
398
|
def get_diagonal(start, coords, slope = true)
|
388
399
|
oper = (slope == true ? :+ : :-)
|
389
400
|
diagonal = (0...height).map do |i|
|
data/lib/gameboard/version.rb
CHANGED