This Python program implements a simple text-based Minesweeper game. It consists of three main classes: GamePlay, Board, and MSSquare, which manage the gameplay, board setup, and square properties respectively.
To play the game, run the minesweeper.py file. Follow the prompts to choose the board size and the number of mines. Input coordinates to sweep the mines. The game continues until you either win or lose.
- Manages the player's input with the game board.
- Contains methods for checking win condition, handling player moves, and exposing the board.
- Sets up the terms of the game, including board size and number of mines.
- Creates the game board matrix and handles populating mines and adding neighbors.
- Represents a single square on the game board.
- Contains properties for whether it has a mine, is hidden, and the number of neighboring mines.
- Run the
minesweeper.pyfile. - Choose the board size (4 - 9) and the number of mines (1 - 2 * size).
- Enter your name.
- Input coordinates (n, m) to sweep the mines.
- Continue until you either win or lose.
- Optionally, choose to play another game.
python minesweeper.py