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 · Native Minesweeper player

JiraiMounttype

Controls for reading and operating a mounted board.

Import it

import type { JiraiMount } from "@johnmorrisdotca/jirai/play";

Definition

type JiraiMount = {
    game: () => Game;
    progress: () => string;
    play: (cell: number, mark?: boolean) => void;
    hint: () => void;
    restart: () => void;
    load: (settings: Settings, progress?: string) => void;
    set: (options: DrawOptions) => void;
    destroy: () => void;
};

Members

NameTypeDescription
game() => Game
progress() => string
play(cell: number, mark?: boolean) => void
hint() => void
restart() => void
load(settings: Settings, progress?: string) => void
set(options: DrawOptions) => void
destroy() => void

Examples

import type { Settings } from "@johnmorrisdotca/jirai";
import { newGame, play } from "@johnmorrisdotca/jirai";
import type { JiraiMount } from "@johnmorrisdotca/jirai/play";
import { mountJirai } from "@johnmorrisdotca/jirai/play";

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 host=document.createElement("div");
document.body.append(host);
const mounted: JiraiMount=mountJirai(host,{settings});
console.log(mounted.game().status);
mounted.destroy();

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