@terminalgames/ink-minesweeper
v0.1.0
Published
Terminal Minesweeper built with Ink.
Maintainers
Readme
Ink Minesweeper
Terminal Minesweeper built with Ink.
Install
Requires Node 20+.
The unscoped name ink-minesweeper is already taken on npm, so this package publishes as @terminalgames/ink-minesweeper. The command is still ink-minesweeper.
Run without installing (easiest)
npx @terminalgames/ink-minesweeperGlobal install
If npm install -g fails with EACCES, your npm global prefix is probably system-owned (/usr/local). Either use npx above, or point npm at a user-owned directory:
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm install -g @terminalgames/ink-minesweeperThen:
ink-minesweeperHow to play
Move the cursor to a cell and reveal it. The first reveal is always safe — mines are placed only after your first click, keeping the clicked cell and its neighbors mine-free so you always open a region. A revealed number tells you how many of the 8 surrounding cells hold mines. Flag the mines, reveal everything else, and you win. Reveal a mine and it's over.
Chord speeds things up: stand on a revealed number whose adjacent mines are all flagged
and press c to reveal every remaining neighbor at once.
Controls
| Key | Action |
| --- | --- |
| h / j / k / l or arrows | Move cursor |
| space / enter | Reveal |
| f | Toggle flag |
| c | Chord (reveal around a satisfied number) |
| 1 / 2 | Beginner (9×9, 10) / Intermediate (16×16, 40) — starts a new game |
| r | Restart |
| p | Pause |
| ? | Toggle help |
| q | Quit |
Difficulties & seed
Two difficulties ship in this version: Beginner (9×9, 10 mines) and Intermediate
(16×16, 40 mines). Pick one at launch or switch any time with 1 / 2.
ink-minesweeper --difficulty intermediate
ink-minesweeper --seed 42
ink-minesweeper --seed 42 --difficulty intermediateA fixed --seed makes mine placement reproducible for a given sequence of moves.
Development
npm install
npm run build
node dist/cli.js
node dist/cli.js --seed 42 --difficulty intermediatenpm test
npm run typecheckGame logic lives in pure TypeScript modules under src/game/; Ink UI is under src/ui/.
Publish
Maintainers only. Requires access to the @terminalgames npm organization:
npm login
npm publish --access public