minesweeper-cl 0.0.0 → 0.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/minesweeper +49 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98d5cda6be2ecf231223867f8ce4be1fa0872460
|
4
|
+
data.tar.gz: 51ccdff1b2d6d0f2f72eff31b6bae02c1ca3f3ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9249e76cf2c487d82d05c5e5548aacad1294490f93de47d34401f0bb67ec3babadfa9efd437035cdafc522e83d52308d030161222daed32fca0aa49668f1db12
|
7
|
+
data.tar.gz: 29becf9db5bedb04c70f7a5fd7049c13a288aa51bb9b70e7de0e1380aa2867dd9043c923295a7873e2fd2ed0cfd12dd2386e869d06ff67edf3bddd39a0ab42ac
|
data/bin/minesweeper
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require_relative 'game_tile'
|
3
|
+
require_relative 'minesweeper_game'
|
4
|
+
require_relative 'game_board'
|
5
|
+
|
6
|
+
puts "Welcome to the game of minesweeper!"
|
7
|
+
puts "-----------------------------------"
|
8
|
+
puts "Please enter the amount of rows that you would like to play with, anything more than 20 will be truncated."
|
9
|
+
rows = gets.chomp.to_i
|
10
|
+
|
11
|
+
while !rows.is_a?(Integer) do
|
12
|
+
puts "Please enter the amount of rows that you would like to play with, anything more than 20 will be truncated."
|
13
|
+
rows = gets.chomp.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
puts "Please enter the amount of cols that you would like to play with, anything more than 20 will be truncated."
|
17
|
+
cols = gets.chomp.to_i
|
18
|
+
|
19
|
+
while !cols.is_a?(Integer) do
|
20
|
+
puts "Please enter the amount of cols that you would like to play with, anything more than 20 will be truncated."
|
21
|
+
cols = gets.chomp.to_i
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "Please enter the % chance you want for a bomb to occur"
|
25
|
+
bomb_chance = gets.chomp.to_f
|
26
|
+
|
27
|
+
while !bomb_chance.is_a?(Float) do
|
28
|
+
puts "Please enter the % chance you want for a bomb to occur"
|
29
|
+
bomb_chance = gets.chomp.to_f
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create the board
|
33
|
+
board = GameBoard.new(rows, cols, bomb_chance)
|
34
|
+
|
35
|
+
|
36
|
+
# Use the MinesweeperGame class to play the game
|
37
|
+
game = MinesweeperGame.new(board, rows, cols)
|
38
|
+
|
39
|
+
game.print_the_board
|
40
|
+
while !game.game_over? && !game.win? do
|
41
|
+
game.play_the_game
|
42
|
+
end
|
43
|
+
|
44
|
+
if game.game_over?
|
45
|
+
puts "Oops! You selected a bomb. Please play again!"
|
46
|
+
elsif game.win?
|
47
|
+
puts "Congrats you won the game!"
|
48
|
+
end
|
49
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minesweeper-cl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gr1zzly_be4r
|
@@ -12,10 +12,12 @@ date: 2015-02-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
13
13
|
description: Minesweeper, ported to the command line
|
14
14
|
email:
|
15
|
-
executables:
|
15
|
+
executables:
|
16
|
+
- minesweeper
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
20
|
+
- bin/minesweeper
|
19
21
|
- lib/game_board.rb
|
20
22
|
- lib/game_tile.rb
|
21
23
|
- lib/minesweeper.rb
|