No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Igor Serebryany d3e1462f64
color clue digits and switch flag to red triangle emoji
The white-flag codepoint renders as a narrow text glyph in many fonts,
breaking column alignment. Switch to the red triangular flag, which is
unambiguously a 2-cell emoji. Also color the clue digits with the
classic minesweeper palette for legibility.
2026-04-30 16:47:11 -07:00
.gitignore switch from poetry to uv with PEP 723 inline metadata 2026-04-30 16:40:36 -07:00
mise.toml switch from poetry to uv with PEP 723 inline metadata 2026-04-30 16:40:36 -07:00
README.md switch from poetry to uv with PEP 723 inline metadata 2026-04-30 16:40:36 -07:00
sweeper.png README: add screenshot 2022-03-22 15:25:06 -07:00
sweeper.py color clue digits and switch flag to red triangle emoji 2026-04-30 16:47:11 -07:00

Sweeper

This is a basic ncurses minesweeper game. It is written in Python, using the awesome curtsies library for interacting with the terminal.

Running

This is a single-file script that uses PEP 723 inline metadata, so uv handles everything — Python version, virtualenv, and dependencies — on first run.

$ ./sweeper.py

Or, equivalently:

$ uv run sweeper.py

Interface

The following commands are supported:


Key Action
h Display in-game help menu
c Close any open in-game menu
l Pick difficulty level
n Start a new game

While a game is in-progress, use the arrow keys (←,↑,→,↓) to move the cursor around the mine field. Hit <SPACE> to open the cell under the cursor. Hit f to flag a cell as a mine. Hitting <SPACE> on an already-opened clue cell will highlight adjacent cells. If the number of neighboring cells that are flagged equals the value of the clue, then all remaining unflagged cells will be opened.

Screenshot

TODO

I wanted to implement a version of sweeper where you don't have to guess, but this turned out to be more complicated than I thought.