本文へ移動

Jirai地雷

シード付きの地雷の盤を作り、見える数字からヒントを証明し、四角・四近傍・六角・端がつながる盤で遊べます。

「地雷」は、地面に埋められた爆弾のことです。 名前について(英語)

目次

リファレンス · 規則・生成・推論

Measure型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

How demanding a dealt board is to solve by deduction, measured by solving it.

インポート

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

定義

type Measure = {
    density: number;
    cells: number;
    opening: number;
    proofs: ProofTally;
    multiStep: number;
    depth: number;
    score: number;
    solvable: boolean;
};

メンバー

名前型説明
densitynumber

Mines per playable cell.

cellsnumber

Playable cells.

openingnumber

Share of the safe cells the first reveal opens before any reasoning.

proofsProofTally

Cells proved by each kind of reasoning: one clue, two clues together, the mine counter, or every arrangement of a small frontier.

multiStepnumber

Share of the playable cells proved by anything beyond one clue's count: the part of the board that needs multi-step reasoning.

depthnumber

The longest chain of deductions, each resting on the one before.

scorenumber

One number for ranking boards: higher is harder. Not a calibrated rating, but monotone in each part above.

solvableboolean

The board can be finished by deduction alone.

例

import type { Measure, Settings } from "@johnmorrisdotca/jirai";
import { makeBoard, measureBoard } 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: Measure = measureBoard(board);
console.log(value);
{
  density: 0.1111111111111111,
  cells: 9,
  opening: 1,
  proofs: { count: 1, overlap: 0, total: 0, enumeration: 0 },
  multiStep: 0,
  depth: 1,
  score: 11.4,
  solvable: true
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/jirai 0.5.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。