gameboard 3.2.0 → 3.3.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
  SHA1:
3
- metadata.gz: 3d86553a1674c0aa11beb770b773c5649d7fb00b
4
- data.tar.gz: 80de723ea7c875558262bf6139e3a2a177191fe2
3
+ metadata.gz: a75a1e26fff0c9732c3ceb2df8bc9560ef11f384
4
+ data.tar.gz: 830853508ed74e568473d9e3ae203c712477b6b5
5
5
  SHA512:
6
- metadata.gz: eb75f48f6cfc03ebb73ba05264a42f7c1a2cf75b803b85d2c9b36769daf5cc350b27580775163be001c0811cbbb5885fa4eae46d5d41e2eb3b43d3340a527fa0
7
- data.tar.gz: dbf5310cc97d2e35b8bde53492411167108378001aff78eda856d58e56ffe7748fbb26cde31b91b8fbda40659610a1d739403ca37c382ba386b2fd8a9386c18c
6
+ metadata.gz: c3c0c783cfa27f534786b4e18aec2b8325cea9c778ce5b55cbace5fb3c8872029b7ef386d85a81b642403e18fe3ebdbae32bbf4c2c35910f5b6e9689cb39a952
7
+ data.tar.gz: d4532686715873ca4a71cbc831bbab40770d218a91cef773b9dcf7cd475188d42a819e2420e0b1203f3acc4b9ac69d9355918a4a733e3193eba79876975de94a
data/README.md CHANGED
@@ -23,6 +23,10 @@
23
23
 
24
24
  - Includes the Enumerable module.
25
25
 
26
+ - Methods, for modifying Board data:
27
+ - Gameboard::Board.randomize(value)
28
+ - Gameboard::Board.set_cell([x,y], value)
29
+
26
30
  - Methods for returning different arrangements of cells of the on the board:
27
31
  - Gameboard::Board.horizontal
28
32
  - Gameboard::Board.vertical
@@ -338,8 +338,17 @@ module Gameboard
338
338
  end
339
339
  end
340
340
 
341
+ # Public: Set random cells to a given value.
342
+ #
343
+ # piece - A value to set to cells
344
+ #
345
+ def randomize(piece)
346
+ rand(1...board.length).times do
347
+ board[rand(board.length)].value = piece
348
+ end
349
+ end
341
350
  # Public: Set a cells value at a given coordinate
342
- #
351
+ #
343
352
  # coord - A coordinate pair in the form X, Y
344
353
  def set_cell(coord, value)
345
354
  cell = find_cell(coord)
@@ -477,7 +486,7 @@ module Gameboard
477
486
 
478
487
  # Internal: use the Coordinate::neighbors function to collect the
479
488
  # neighbors of a given Coordinate on the existing gameboard
480
- #
489
+ #
481
490
  # point - instance of Coordinate class at a specific x,y point
482
491
  def valid_neighbors(coord)
483
492
  coord.neighbors.collect { |point| find_cell(point) }.compact
@@ -1,3 +1,3 @@
1
1
  module Gameboard
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gameboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley