本文へ移動

Kazu数

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

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

目次

リファレンス · 数字パズルのエンジン

kazuRefusal関数

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

A refusal: { ok: false }, the English reason (the clause of the code with the values in its gaps), the code and the values.

インポート

import { kazuRefusal } from "@johnmorrisdotca/kazu";

定義

function kazuRefusal(code: KazuCheckCode, values?: KazuCheckValues): Extract<KazuCheck, { ok: false; }>

引数

名前型説明
code"no-kind-at" | "no-check" | "givens-not-grid" | "givens-not-regions" | "givens-not-cages" | "givens-not-marks" | "givens-not-clues" | "regions-not-sound" | "answer-not-grid" | "answer-has-empty-cells" | "given-changed" | "row-repeats" | "column-repeats" | "box-repeats" | "region-repeats" | "diagonal-repeats" | "cage-repeats" | "cage-sum-wrong" | "mark-not-true" | "clue-sees-wrong"

Why the answer is not taken.

values (省略可)Readonly<Record<string, string | number>> | undefined

What fills the clause's gaps, where it has any.

戻り値

{ ok: false; reason: string; code: KazuCheckCode; values?: KazuCheckValues; }

The refusal checkKazu gives.

例

import { kazuRefusal } from "@johnmorrisdotca/kazu";

console.log(kazuRefusal("row-repeats", { n: 3 }));
{
  ok: false,
  reason: 'row 3 repeats a number',
  code: 'row-repeats',
  values: { n: 3 }
}

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

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

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