Skip to content

ramses-z/minesweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minesweeper

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.

loss leaderboard debug
Gameplay Leaderboard Debug Mode

Table of Contents

  1. Features
  2. Requirements and Setup
  3. File Structure
  4. How to Play
  5. Code Overview
  6. Acknowledgements

Features

  • 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.

Requirements and Setup

  • SFML (2.5.1)
  • C++15 or later

Setup Instructions

  1. Clone this repository:
    git clone https://github.com/ramses-z/minesweeper.git
  2. Navigate to the directory:
    cd minesweeper
  3. Build and run the game using the provided makefile:
    make
  4. Run the game:
    ./minesweeper.out

File Structure

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

How to Play

  1. Start the Game: Click on any tile to start.
  2. 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.
  3. Flag Mines: Right-click on tiles to place flags, indicating suspected mines.
  4. Pause/Resume: Click the pause button to pause or resume the timer.
  5. Leaderboard: Access the leaderboard to view top scores.

Code Overview

  • 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.

Acknowledgements

  • This project was completed using the assigned structure and assets provided by the University of Florida.

Enjoy the game!

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published