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

GenerationErrorclass

A bounded generator must say it failed, never quietly return a guessing board.

Import it

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

Definition

class GenerationError
new GenerationError(code: "settings" | "opening" | "exhausted", message: string): GenerationError

Parameters

NameTypeDescription
code"opening" | "settings" | "exhausted"

settings for invalid input, opening for an impossible safe opening, or exhausted for a spent generation budget.

messagestring

The readable reason for generation failure.

Members

NameTypeDescription
code"opening" | "settings" | "exhausted"
namestring
messagestring
stack (optional)string | undefined
cause (optional)unknown

Examples

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

const error=new GenerationError("exhausted","No proved field within this budget");
console.log(error.code,error.message);
exhausted No proved field within this budget

What it prints (run when this page was built)

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