-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
78 lines (74 loc) · 1.48 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Problems:
- some specs fails from time to time due to rounding errors when calculating the number of visible tiles: multiple runs will solve the problem
- I had to duplicate some code in board_spec.rb to keep the private methods private
- I didn't find a way to remove the caller from pry output when calling binding.pry
EXAMPLE USAGE:
$~ exe/minesweeper --width 10 --height 24 --difficulty easy
[1] pry(#<Minesweeper::Game>)> display
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXX3XXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXX3XXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXX0
XXXXXXXXXX
XXXXXXXXXX
=> nil
[2] pry(#<Minesweeper::Game>)> attempt(100,100)
StandardError: Invalid coordinates
from /home/ngw/Projects/minesweeper/lib/minesweeper/game.rb:52:in `validate_coords'
[3] pry(#<Minesweeper::Game>)> attempt(2,3)
=> true
[4] pry(#<Minesweeper::Game>)> attempt(2,4)
=> true
[5] pry(#<Minesweeper::Game>)> attempt(2,5)
=> true
[6] pry(#<Minesweeper::Game>)> attempt(2,6)
=> true
[7] pry(#<Minesweeper::Game>)> attempt(2,7)
=> true
[8] pry(#<Minesweeper::Game>)> attempt(2,8)
BOOM!!!
=> nil
[9] pry(#<Minesweeper::Game>)> display
22101*3**2
**1023*6*3
34322*4**2
*3**32*431
13**212*10
0123211110
1111*21111
2*1123*11*
*3313*3222
2*2*3*21*2
112121124*
00000112**
000001*332
2221123*21
**3*33*32*
223*3**211
1222333211
*3*32*23*2
35*4*4*3*2
**4*3*2211
**42311000
344*222100
1**22**111
122112211*
=> nil