本文へ移動

Kazu数

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

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

目次

リファレンス

ひとりにしてくれの規則

import { … } from "@johnmorrisdotca/kazu/hitori";

最小化と gzip 圧縮をしたサイズは 4.5 kB(読み込むものをすべて含み、esbuild で計測)

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

エクスポート

名前種類概要
checkHitori関数Checks unshaded row and column duplicates, adjacent shades, and white connectivity.
decodeHitori関数Read a native saved Hitori game, or null for invalid board data or progress.
encodeHitori関数Versioned public clue and mark data; the generated answer is not saved.
generateHitori関数Makes a seeded puzzle and proves its answer is the only one.
hintHitori関数Gives one next shade in the unique minimal solution, if uniqueness was proved.
HITORI_LEAST_SIDE定数The minimum supported Hitori board dimension.
HITORI_LEVELS定数How hard a puzzle is made, by what a person must do to solve it; see rateHitori.
HITORI_MAX_NODES定数The native Hitori search-node budget.
HITORI_MOST_ATTEMPTS定数The native Hitori generation-attempt limit.
HITORI_MOST_SIDE定数The maximum supported Hitori board dimension.
HITORI_SIZES定数The sides on offer; any side from 4 to HITORI_MOST_SIDE is a board isHitoriBoard takes.
HitoriBoard型Hitori dimensions and printed clues in their native row-major representation.
HitoriGame型The immutable Hitori board, current entries or marks, undo history and assistance state.
HitoriLevel型A native difficulty tier for generated Hitori puzzles.
hitoriNeighbors関数Read orthogonally adjacent cells on a square Hitori board.
HitoriPuzzle型A seeded Hitori board with its verified solution and native difficulty tier.
HitoriRating型How hard a board is, measured by solving it.
HitoriSolve型A bounded Hitori solve result: answer count, first solution, node work and whether the search completed.
isHitoriBoard関数Whether the value has valid native Hitori dimensions, clues and data.
newHitori関数Create the initial immutable Hitori game from a valid board.
rateHitori関数Rates a board with one answer by solving it: with the plain rules, with the whites-stay-together rule, then by supposing.
restartHitori関数Return the Hitori game reset to its initial entries or marks.
shadeHitori関数Apply the requested native Hitori entry or mark to a new immutable game; invalid or fixed targets stay unchanged.
solveHitori関数Counts distinct minimal shade patterns: an answer shades only squares that settle a duplicate, so extra shades are never a second answer.
undoHitori関数Return the Hitori game with its previous marks or entries restored, or unchanged when there is no undo history.

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

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