https://github.com/maskedsyntax/minesweeper
Terminal based Minesweeper game in C++
https://github.com/maskedsyntax/minesweeper
cpp game minesweeper recursion-problem terminal
Last synced: about 1 month ago
JSON representation
Terminal based Minesweeper game in C++
- Host: GitHub
- URL: https://github.com/maskedsyntax/minesweeper
- Owner: MaskedSyntax
- Created: 2021-04-28T12:57:12.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-24T23:09:23.000Z (over 1 year ago)
- Last Synced: 2025-02-05T01:33:07.182Z (over 1 year ago)
- Topics: cpp, game, minesweeper, recursion-problem, terminal
- Language: C++
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minesweeper
A modern C++ implementation of the classic Minesweeper game. Test your logic by navigating a hidden minefield using a command-line interface with color support and robust gameplay mechanics.
## Features
- **Difficulty Levels:**
- Beginner: 9x9 grid with 10 mines.
- Intermediate: 16x16 grid with 40 mines.
- Advanced: 24x24 grid with 99 mines.
- **Gameplay Mechanics:**
- **First Move Safety:** Your first move is guaranteed to be safe; mines are placed after your first reveal.
- **Flagging System:** Mark suspected mines to keep track of the board.
- **Recursive Reveal:** Clearing an empty cell automatically reveals all adjacent safe cells.
- **Visual Feedback:** ANSI colors highlight different numbers and mine locations for better readability.
- **Play Again Loop:** Start a new game immediately after finishing a session.
## How to Play
1. **Compile the Game:**
Use a C++11 compatible compiler:
```bash
g++ -std=c++11 main.cpp -o minesweeper
```
2. **Select Difficulty:** Choose between Beginner (0), Intermediate (1), or Advanced (2).
3. **Enter Commands:**
- To reveal a cell: `r row column` (e.g., `r 3 4`)
- To flag/unflag a cell: `f row column` (e.g., `f 3 4`)
4. **Win or Lose:** Successfully reveal all safe cells to win, or hit a mine to lose.
Challenge yourself to navigate the minefield and win the game!