Minesweeper

Back to projects list

Data structuresHTML UIRecursion

QuinticFormula, via Wikimedia Commons CC BY-SA 4.0 licensed.

Minesweeper is a grid-based puzzle game where the goal is to clear a minefield without setting off any of the hidden mines. The graphic and user interaction are fairly simple—each cell either displays a blank tile, a red flag, or a number from 1 to 8 and all the user can do is click and right click on individual cells. The UI should be straightforward to build in HTML and CSS.

Under the covers, the game must keep track of which cells contain the hidden mines and be able to clear cells adjacent to cells selected by the user that are free of mines and indicate cells that are next to one or more mines with the number of adjacent mines. The process of traversing the neighboring cells until the boundary is found would be a good exercise in using recursion.

References