Skip to the content

Jirai地雷

Deal seeded minefields, prove hints from visible clues and mount square, orthogonal, hexagonal or wraparound boards.

Jirai is the Japanese word 地雷 for a land mine. About the name

Contents

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

NameTypeDescription
densitynumber

Mines per playable cell.

cellsnumber

Playable cells.

openingnumber

Share of the safe cells the first reveal opens before any reasoning.

proofsProofTally

Cells proved by each kind of reasoning: one clue, two clues together, the mine counter, or every arrangement of a small frontier.

multiStepnumber

Share of the playable cells proved by anything beyond one clue's count: the part of the board that needs multi-step reasoning.

depthnumber

The longest chain of deductions, each resting on the one before.

scorenumber

One number for ranking boards: higher is harder. Not a calibrated rating, but monotone in each part above.

solvableboolean

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jirai 0.5.0.