← All apps

CandyMines

💣 CandyMines

Minesweeper on the SugarCraft stack

port of go-sweep game minesweeper candycore deterministic-rng

Customisable board (width / height / mine count), recursive zero-flood-fill, win / lose detection. Pure-state Board class so every reveal is unit-testable without touching the runtime.

Install

composer require candycore/candy-mines

Quickstart

./bin/candy-mines              # 10×10, 12 mines (defaults)
./bin/candy-mines 16 16 40     # custom board

// Programmatic:
use CandyCore\Core\Program;
use CandyCore\Core\ProgramOptions;
use CandyCore\Mines\Game;

(new Program(Game::start(width: 16, height: 16, mines: 40),
             new ProgramOptions(useAltScreen: true)))->run();

What's in the box

First-click safetyMines aren't placed until the first reveal, with the clicked cell's 3×3 neighbourhood excluded — every game gets a non-trivial flood-fill on click 1.
Recursive flood fillZero-adjacency cells reveal their neighbours transitively, exactly like the original.
Vim-style movementhjkl alongside arrows; cursor clamps at board edges.
Flag togglef flags / unflags the cursor cell; flagged cells can't be revealed by accident.
Win + lose detectionisWon = every non-mine revealed; exploded = at least one mine was clicked.
Restart keyr reseeds with a fresh layout, preserving the chosen board size.

Source & demos

Try the quickstart →

Demos.

VHS-recorded GIFs of every example shipped with the app. Regenerated automatically on every push that touches the source.

Play

Play

Cursor walk, flood-fill reveal, flag plant.