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

How-to

Prove hints from visible clues

Use VisibleGame and distinguish flags, proof and contradictions.

Pass the visible projection

import { newGame,play,visibleGame,hintFor,type Settings } from "@johnmorrisdotca/jirai";
const settings: Settings={width:3,height:3,mines:1,grid:"square",noGuess:false,opening:"clear",seed:42};
const game=play(newGame(settings),{kind:"reveal",cell:0});
const hint=hintFor(visibleGame(game));
console.log(hint.safe,hint.mines,hint.reason,hint.contradiction);
[] [ 2 ] count false

VisibleGame contains opened clues and marks. Hidden clues, including flags, are null. A player’s flag is not a proved mine. Supply knownMines only for earlier proof results. Deduction reports certain safe cells, certain mines, the native reason and the source clues. An empty result means no proof was found by the enabled bounded deductions; it is not permission to guess automatically.

Keep answers at the trusted boundary

Game.board and a dealt Board include mine locations for the rules engine and generation checks. Use the visible projection for hints and public display before the game ends. contradiction identifies inconsistent visible constraints. Showing a proved hint records assistance in the native player; keep that marker in saved progress.

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