Mine Sweeper
2023-06-17
Source: 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 with zero neighboring mines sets off discoverAroundTile, a small recursive function 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 on space bar that reveals every unflagged tile around the one you're hovering, so you can clear a region in one go once you've flagged its mines.