This project involves creating a Minesweeper game in Python, which can be played directly in the terminal. The goal of the game is to clear a minefield without detonating any mines, using clues that indicate the number of neighboring mines for each tile.
The game takes place on a rectangular field with several tiles, some of which contain hidden mines. Each tile can be in one of three possible states: covered, cleared, or flagged.
- Covered: The tile is hidden, and the player doesn't know whether it's safe or contains a mine.
- Cleared: The player revealed the tile. If it's safe, it shows a number indicating the number of neighboring mines. If there are no mines around, neighboring tiles are automatically cleared.
- Flagged: The player can flag a tile to indicate they believe a mine is there. Flagged tiles remain covered, and the player can later unflag or clear them.
- Clearing tiles: The player can clear a tile. If it contains a mine, the game ends. Otherwise, the number of neighboring mines is displayed.
- Flagging tiles: The player can flag a tile if they suspect it contains a mine. If the player flags all the mines correctly, they win the game.
- Neighboring tiles: Each turn, the player can clear or flag a tile. Tiles neighboring a cleared tile with a value of 0 are automatically cleared.
- Mine placement: Mines are placed randomly on the field after the player chooses their first tile to clear. The first tile cleared will never contain a mine or have any neighboring mines.
This game is developed in Python. To play, make sure you have Python installed on your computer.