Reference · Rules, generation and deductions
Measuretype
How demanding a dealt board is to solve by deduction, measured by solving it.
Import it
import type { Measure } from "@johnmorrisdotca/jirai";
Definition
type Measure = {
density: number;
cells: number;
opening: number;
proofs: ProofTally;
multiStep: number;
depth: number;
score: number;
solvable: boolean;
};
Members
| Name | Type | Description |
|---|---|---|
density | number | Mines per playable cell. |
cells | number | Playable cells. |
opening | number | Share of the safe cells the first reveal opens before any reasoning. |
proofs | ProofTally | Cells proved by each kind of reasoning: one clue, two clues together, the mine counter, or every arrangement of a small frontier. |
multiStep | number | Share of the playable cells proved by anything beyond one clue's count: the part of the board that needs multi-step reasoning. |
depth | number | The longest chain of deductions, each resting on the one before. |
score | number | One number for ranking boards: higher is harder. Not a calibrated rating, but monotone in each part above. |
solvable | boolean | The board can be finished by deduction alone. |
Examples
import type { Measure, Settings } from "@johnmorrisdotca/jirai";
import { makeBoard, measureBoard } from "@johnmorrisdotca/jirai";
const settings: Settings={width:3,height:3,mines:1,grid:"square",noGuess:false,opening:"clear",seed:42};
const board=makeBoard(settings,0,{attempts:1,repair:false});
const value: Measure = measureBoard(board);
console.log(value);{
density: 0.1111111111111111,
cells: 9,
opening: 1,
proofs: { count: 1, overlap: 0, total: 0, enumeration: 0 },
multiStep: 0,
depth: 1,
score: 11.4,
solvable: true
}What it prints (run when this page was built)