File tree Expand file tree Collapse file tree 1 file changed +29
-19
lines changed Expand file tree Collapse file tree 1 file changed +29
-19
lines changed Original file line number Diff line number Diff line change 1
1
# Minesweeper
2
2
3
- Add the numbers to a minesweeper board.
3
+ Add the mine counts to a completed Minesweeper board.
4
4
5
5
Minesweeper is a popular game where the user has to find the mines using
6
6
numeric hints that indicate how many mines are directly adjacent
7
7
(horizontally, vertically, diagonally) to a square.
8
8
9
9
In this exercise you have to create some code that counts the number of
10
- mines adjacent to a square and transforms boards like this (where ` * `
11
- indicates a mine):
12
-
13
- +-----+
14
- | * * |
15
- | * |
16
- | * |
17
- | |
18
- +-----+
19
-
20
- into this:
21
-
22
- +-----+
23
- |1*3*1|
24
- |13*31|
25
- | 2*2 |
26
- | 111 |
27
- +-----+
10
+ mines adjacent to a given empty square and replaces that square with the
11
+ count.
12
+
13
+ The board is a rectangle composed of blank space (' ') characters. A mine
14
+ is represented by an asterisk ('\* ') character.
15
+
16
+ If a given space has no adjacent mines at all, leave that square blank.
17
+
18
+ ## Examples
19
+
20
+ For example you may receive a 5 x 4 board like this (empty spaces are
21
+ represented here with the '·' character for display on screen):
22
+
23
+ ```
24
+ ·*·*·
25
+ ··*··
26
+ ··*··
27
+ ·····
28
+ ```
29
+
30
+ And your code will transform it into this:
31
+
32
+ ```
33
+ 1*3*1
34
+ 13*31
35
+ ·2*2·
36
+ ·111·
37
+ ```
28
38
29
39
## Rust Installation
30
40
You can’t perform that action at this time.
0 commit comments