blob: 7cc93be2991d865769d18542c8e87186ad4fa759 (
plain)
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
|
# Mine Sweeper
A Minesweeper clone in C and SDL2, and the project where recursive flood-fill finally clicked for me.
A 10x10 board gets seeded with 15 mines, each tile counts the mines in its own 3x3 neighborhood, and clicking an empty tile (zero neighboring mines) sets off a small recursive reveal that keeps opening neighbors until it runs into a ring of numbered tiles on every side. Watching that cascade unfold correctly for the first time, opening up a whole empty region from a single click, was the fun part of this one.
There's also a chording shortcut that reveals every unflagged tile around the one you're hovering, for clearing a region in one go once you've flagged its mines.
## Controls
- Left click: reveal a tile
- Right click: flag/unflag a tile
- `Space`: chord (reveal all unflagged neighbors of the hovered tile)
## Building
Needs SDL2 and SDL2_ttf.
```sh
make
./mine_sweeper
```
## License
GPLv3, see `LICENSE`.
|