This is a simple Minesweeper game developed using Python and Tkinter. The game consists of a grid with hidden mines, and the player must reveal cells without triggering any mines.
This game was initially developed by following a YouTube tutorial. You can find the tutorial here: YouTube Tutorial Link. The tutorial helped build the basic structure of the Minesweeper game.
However, additional features and improvements have been made beyond the tutorial, including:
- Safe First Click: Ensured that the first click will never reveal a mine, enhancing the user experience.
- Auto-Open Adjacent Cells: Implemented a feature where clicking a cell with zero adjacent mines automatically opens surrounding cells, making gameplay smoother.
- Timer Integration: A custom timer that tracks game time and updates dynamically.
- Game Over Handling: A custom
gameover.pyscript that gracefully handles game termination. - Additional Enhancements: Improved user interface and extended functionality.
main.py: The main entry point for the game, initializes the window and runs the game loop.cell.py: Manages the logic for individual cells in the Minesweeper grid.gameover.py: Handles the game's end conditions and displays messages for winning or losing.timer.py: Contains theTimerclass responsible for handling the stopwatch functionality.timer_manager.py: Manages interactions between the game logic and the timer objects.settings.py: Defines game settings such as grid size, number of mines, and window dimensions.utils.py: Utility functions for calculating grid cell dimensions based on window size.
These instructions will help you set up the project locally on your machine.
- Python 3.x
- Tkinter (included with most Python distributions)
- Clone the repository:
git clone https://github.com/mathew06/Minesweeper.git
- Navigate to the project directory:
cd Minesweeper - Run the game:
python main.py
Contributions are welcome! If you have any suggestions, improvements, or bug fixes, feel free to submit a pull request or open an issue.