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

gameFromProgressfunction

A saved game is rebuilt under the rules. Malformed or unavailable boards return null.

Import it

import { gameFromProgress } from "@johnmorrisdotca/jirai";

Definition

function gameFromProgress(progress: string): Game | null

Parameters

NameTypeDescription
progressstring

The versioned native move record to validate and replay.

Returns

Game | null

The validated replayed native game, or null for invalid, unsupported or unavailable saved data.

Examples

import type { Settings } from "@johnmorrisdotca/jirai";
import { gameFromProgress, gameProgress, newGame, play } 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});
console.log(gameFromProgress(gameProgress(game))?.status);
won

What it prints (run when this page was built)

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