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

Boardtype

A dealt board including its answer; keep it off public clients.

Import it

import type { Board } from "@johnmorrisdotca/jirai";

Definition

type Board = {
    settings: Settings;
    mines: readonly boolean[];
    clues: readonly number[];
    first: number;
    attempt: number;
};

Members

NameTypeDescription
settingsSettings
minesreadonly boolean[]
cluesreadonly number[]
firstnumber
attemptnumber

Which candidate this deal was: below the attempts limit it is a random layout, at or above it a repaired one.

Examples

import type { Board, Settings } from "@johnmorrisdotca/jirai";
import { makeBoard } 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: Board = board;
console.log(value);
{
  settings: {
    width: 3,
    height: 3,
    mines: 1,
    grid: 'square',
    noGuess: false,
    opening: 'clear',
    seed: 42
  },
  mines: [
    false, false,
    true,  false,
    false, false,
    false, false,
    false
  ],
  clues: [
    0, 1, -1, 0, 1,
    1, 0,  0, 0
  ],
  first: 0,
  attempt: 0
}

What it prints (run when this page was built)

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