minesweeper-cli 1.0.0 → 1.0.1

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: d710c1e40315619906f82b3bebbc4f1308f90419
4
- data.tar.gz: 32cb01b79aac187fc8f87841fd1cc6e490e8dab1
3
+ metadata.gz: 9f0c08e11c5a81900fd32c6bbc6cc8741d7c99d6
4
+ data.tar.gz: bed5cf67783727d4e705f76fd3c841b55dcb9810
5
5
  SHA512:
6
- metadata.gz: cb1541c26f02d2d359f2b3176cf92a65f21df84fdf0af035ab24a02fcc0ab99531a19d796460791d56cbcb2e7c8b845092b1c926c1795c140e3dd38c31413814
7
- data.tar.gz: ac3e40e003347843b8ee3690a5921b15d0120939d104ae6228505f3bec948f8ff20c88dafb5ec190f5433696cbc4a6fe322020b538c4a80c54fbc97d9f86881d
6
+ metadata.gz: f57c19f8987d78d3e0fdcb5e3e11a14e5af05a32e6eeefdb994c1e9f280c53209f6bca2f6db4d6cc3210196c9a0e17afd44f3a069c608c2d26b0dcc699605375
7
+ data.tar.gz: 7794734fa037b9aa9a83e247dce7c21614047f2a90a562ca32cbc07f78391147d5cd4a052bcf13bdccac98091af1cb1d0b7cb69d8df4a7b35e13deeb6492b852
data/README.md CHANGED
@@ -13,11 +13,11 @@ It comes conveniently packaged as a gem:
13
13
 
14
14
  From the command line:
15
15
 
16
- `./minesweeper`
16
+ `minesweeper`
17
17
 
18
18
  To get some help and options:
19
19
 
20
- `./minesweeper -h`
20
+ `minesweeper -h`
21
21
 
22
22
  By default it's a 10x5 grid, with 3 hidden mines.
23
23
 
@@ -3,7 +3,7 @@ require_relative 'playfield'
3
3
  module Minesweeper
4
4
  class Game
5
5
  def initialize(options)
6
- @playfield = Playfield.new(**options)
6
+ @playfield = Playfield.new(options)
7
7
  end
8
8
 
9
9
  def play
@@ -4,21 +4,21 @@ require_relative 'square'
4
4
  module Minesweeper
5
5
  class Playfield
6
6
 
7
- def initialize(display_set:, mine_number:, rows:, cols:)
8
- @display_set = display_set
9
- @mine_number = mine_number
10
- @rows = rows
11
- @cols = cols
7
+ def initialize(options = {})
8
+ @display_set = options[:display_set]
9
+ @mine_number = options[:mine_number]
10
+ @rows = options[:rows]
11
+ @cols = options[:cols]
12
12
 
13
13
  @revealed_squares = Set.new
14
14
  @mines = Set.new
15
- @playfield = Array.new(rows) { Array.new(cols) }
15
+ @playfield = Array.new(@rows) { Array.new(@cols) }
16
16
 
17
- until mine_number.zero?
18
- mine_position = [rand(rows), rand(cols)]
17
+ until options[:mine_number].zero?
18
+ mine_position = [rand(@rows), rand(@cols)]
19
19
  unless @mines.include?(mine_position)
20
20
  @mines << mine_position
21
- mine_number -= 1
21
+ options[:mine_number] -= 1
22
22
  end
23
23
  end
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module Minesweeper
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minesweeper-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Cruz Horts