A terminal-based implementation of the classic Minesweeper game, built in C.
Navigate through a minefield without detonating any bombs while revealing safe squares!
Minesweeper is a single-player puzzle game, originally invented by Robert Donner in 1989. The objective is to clear a rectangular field of hidden mines without triggering any of them. The game is renowned for its simplicity and strategic depth.
- The game area consists of a rectangular grid of squares.
- Clicking on a square reveals its contents:
- If it contains a mine, the game is over.
- If itโs safe, it either shows a number indicating adjacent mines or reveals adjacent squares if empty.
- You win by revealing all squares that donโt contain mines.
After executing the program, choose an option:
-
Print the Board
Reads a board name fromstdin
(examples included in theboards
directory) and prints the unaltered board tostdout
. -
Print the Board with Hints
Similar to option 1 but includes hints on adjacent mines. -
User Action
Reads a board name and user-specified coordinates to reveal squares until mines are encountered.
git clone https://github.com/voidashi/minesweeper-c.git
Use a C compiler (like gcc
) to compile the source files:
gcc -o minesweeper minesweeper.c
Run the executable to start playing:
./minesweeper
Feel free to open issues or submit pull requests to improve this project!
This project is licensed under the MIT License.