# Deduce Mine: A Minefield That Deals Itself

> Sweep a field where the mines are not planted when the game starts, in one small offline HTML file: every reveal asks a small constraint solver which placements still fit the clues and flags, then deals one. Provably-safe cells are guaranteed empty, provably-deadly ones guaranteed mines, ambiguous ones a fair coin — so a Hint toggle genuinely glows forced cells.

- Type: Lab Skill (downloadable Agent Skill)
- Category: [Game creation](https://www.sandbase.ai/skills/games)
- Version: 0.1.0
- Runs online: yes
- Page: https://www.sandbase.ai/skills/games/deduce-mine

## What you get

Bring the grid and the mine count, the solver rules and the hint, and optionally the flag mode, the undo, the palette and the UI text. The Skill returns a downloadable Skill (the deduction minesweeper project, a customize guide, headless verification) and one playable example field.

## Install

Download the Skill package from https://www.sandbase.ai/skills/games/deduce-mine (sign-in required), unzip it into your agent's skills folder, then ask your agent to use it:

```text
/deduce-mine make a deduction minesweeper where the player reveals <your grid>, flags <your mines>, under <your solver rules>
```

## How it works

1. **Install and run the minefield** Deduce Mine lives in assets/deduce-mine/: npm install, then npm run dev to play at the printed URL. It is pure Canvas 2D with zero runtime dependencies and no sprites. src/config.js holds the board, the palette and both locales, and src/core/ holds the solver, state, renderer and audio. A prompt names your grid, your mine count and your solver rules.
2. **Let the solver deal mines** No mines exist at the start. The first click deals a board with its 3 by 3 ring empty, and every later reveal re-solves clues, flags and the global mine budget, then deals the clicked cell from a consistent placement. src/core/solver.js groups boundary cells into components and enumerates each by backtracking, with a 60k node budget per component.
3. **Build and verify headlessly** npm run build:single writes dist-single/index.html, and npm run shoot needs Chromium. The shoot run covers the menu, a safe first reveal, more reveals, the Hint glow, flag and unflag, a solver-certified safe cell, undo, pause and mute, the Chinese UI and a phone reveal. Win the 12 by 10 board with 22 mines to see the end state.

## FAQ

### How is Deduce Mine different from classic minesweeper?

Deduce Mine does not plant mines when the game starts. Every reveal asks a constraint solver which placements still fit the revealed clues and flags, then deals one. Provably safe cells are guaranteed empty, provably deadly cells are guaranteed mines and only genuinely ambiguous cells are a fair coin.

### What does the Deduce Mine Hint toggle show?

Deduce Mine's Hint glows every boundary cell the solver can prove: green for forced empty and red for forced mine. The status line says whether provable safe cells exist, whether a guess may be forced, or whether everything in reach is deadly. Enter reveals the first provably safe cell.

### Can I undo a death in Deduce Mine?

Yes. Deduce Mine's undo, on U, rewinds the last reveal batch, and a flood counts as one move, so a fatal guess can be taken back. Undo and flags share the same consistent state, so rewinding never leaves a contradiction.

### Why does Deduce Mine sometimes show fewer hints?

Deduce Mine caps its solver at 60k nodes per component. In a very open mid-game an overflowing component is marked opaque, so the hint glow shows fewer cells than are truly provable. It never shows wrong ones.

### Does Deduce Mine need a key or an internet connection?

No. Deduce Mine calls no model and makes no network calls, so playing it costs nothing. Its solver is written for this build, with no vendored SAT library, and sound is a handful of synthesized cues.

### Can I change the Deduce Mine board size?

Not from the game. Deduce Mine ships a fixed 12 by 10 board with 22 mines, one density and no difficulty selector. There is no timer, leaderboard or persistence, and the board settings live in src/config.js for code edits.

## Examples

- Deduce Mine minesweeper game (scene)
- Night Field (video)
