Why I Made This Game
This project began as a challenge from Codecademy's Computer Science course. I wanted to push myself to create something interactive and nostalgic—so I chose to recreate Minesweeper, the classic puzzle game, entirely in the terminal using Python. It was a fun way to apply object-oriented programming concepts and explore how game logic works under the hood.
How It Works
The game is built around two main classes: Tile and Board.
- Tile represents each square on the board. It tracks whether it's a bomb, whether it's been discovered or flagged, and how many bombs are adjacent to it. It also handles its own display logic using ANSI escape codes for colorful terminal output.
- Board manages the grid of tiles. It randomly places bombs, calculates adjacent bomb counts, and handles user input. The board is displayed with column letters and row numbers for intuitive navigation.
The game loop listens for two types of input:
DXY to discover a tile (e.g., DA3)
FXY to flag a tile (e.g., FB5)
The game ends when you either:
Discover a bomb (you lose 💥)
Correctly flag all bombs (you win 🎉)
The logic for recursive discovery (revealing adjacent empty tiles) and color-coded output makes the game feel dynamic and responsive, even in a simple terminal environment.
What I Learned
I really enjoyed the process of building this. It was quick to get up and running, but it also sparked a lot of ideas for future improvements—like adding a timer, difficulty levels, or even turning it into a roguelike-style game with procedural generation and exploration mechanics.

Top comments (0)