本文へ移動

Kazu数

検証済みの数独や論理パズルを作り、標準の規則とヒントを読み、盤を描いたり埋め込んだりできます。

「数」は数字を表す言葉です。 名前について(英語)

目次

リファレンス · ループの規則

LoopRating型

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

How hard a board is, measured by solving it. depth 0 means the plain rules solve it, 1 that somebody has to suppose an edge drawn or crossed and watch it break, 2 that more than that is needed; probes is how many suppositions depth 1 needed. The rest describes the board.

インポート

import type { LoopRating } from "@johnmorrisdotca/kazu/loop";

ほかのエクスポート元: @johnmorrisdotca/kazu

定義

type LoopRating = {
    depth: 0 | 1 | 2;
    probes: number;
    clues: number;
    clueShare: number;
    zeroShare: number;
    loop: number;
};

メンバー

名前型説明
depth0 | 1 | 2
probesnumber
cluesnumber
clueSharenumber

Numbered squares as a share of all squares.

zeroSharenumber

Squares numbered 0 as a share of the numbered ones.

loopnumber

Edges in the loop.

例

import type { LoopBoard, LoopRating } from "@johnmorrisdotca/kazu/loop";
import { rateLoop } from "@johnmorrisdotca/kazu/loop";

const loopBoard: LoopBoard = {"width":5,"height":5,"clues":[2,3,1,null,null,3,1,1,null,null,3,2,2,null,null,3,0,2,2,null,2,2,1,2,3]};
const value: LoopRating = rateLoop(loopBoard);
console.log(value);
{
  depth: 0,
  probes: 0,
  clues: 18,
  clueShare: 0.72,
  zeroShare: 0.05555555555555555,
  loop: 22
}

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

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

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