A classic Minesweeper game implementation using C++ and SFML (Simple and Fast Multimedia Library). This project includes features like a timer, flag counter, pause/play, board regeneration, debug mode, and a leaderboard to record high scores. This project was completed as part of an assignment for the University of Florida.
Gameplay | Leaderboard | Debug Mode |
- Game Timer: Displays elapsed time during gameplay.
- Flag Counter: Tracks the number of remaining mines.
- Leaderboard: Records top scores with time.
- Pause and Resume: Toggle pause with the pause button.
- Debug Mode: Reveals all mines for testing.
- SFML (2.5.1)
- C++15 or later
- Clone this repository:
git clone https://github.com/ramses-z/minesweeper.git
- Navigate to the directory:
cd minesweeper
- Build and run the game using the provided
makefile
:make
- Run the game:
./minesweeper.out
files/
├── images/ # UI Assets
├── board_config.cfg # Stores board configuration
├── font.ttf # Font used for the leaderboard
└── leaderboard.txt # Stores leaderboard information
src/
├── game_board.cpp # Board generation and game logic
├── game_board.h
├── game_tile.cpp # Tile attributes and status
├── game_tile.h
├── main.cpp # Main game loop and SFML setup
├── timer.cpp # Timer management
makefile
minesweeper.out
- Start the Game: Click on any tile to start.
- Reveal Tiles: Left-click on tiles to reveal them.
- If you click on a mine, you lose.
- If you reveal a numbered tile, it indicates how many mines are adjacent to that tile.
- Note: If your first click is on a mine, the board is automatically regenerated to a playable board.
- Flag Mines: Right-click on tiles to place flags, indicating suspected mines.
- Pause/Resume: Click the pause button to pause or resume the timer.
- Leaderboard: Access the leaderboard to view top scores.
main.cpp
: The main game loop, handling user input and updating the game state.game_board.cpp
/game_board.h
: Handles the game board logic, including resetting and checking tiles.game_tile.cpp
/game_tile.h
: Manages individual tile properties like flags, mines, and adjacency counts.timer.cpp
: Manages game timing and keeps track of elapsed seconds.leaderboard.txt
: Stores top scores in a simple text format.makefile
: Compiles the project.
- This project was completed using the assigned structure and assets provided by the University of Florida.
Enjoy the game!