KazuMountOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The puzzle, optional solution/progress, assistance, controls and event callbacks for mounting a number grid.
インポート
import type { KazuMountOptions } from "@johnmorrisdotca/kazu/play";
定義
type KazuMountOptions = {
kind: KazuKind;
size: number;
givens: string;
solution?: string;
level?: KazuLevel;
seed?: number;
run?: string;
notes?: string;
elapsed?: number;
clock?: boolean;
controls?: boolean;
hints?: "place" | "show" | "off";
check?: "count" | "show" | "off";
conflicts?: boolean;
peers?: boolean;
tidy?: boolean;
tapToStep?: boolean;
language?: KazuLanguage;
onChange?: (detail: KazuEventDetail) => void;
onHint?: (detail: KazuEventDetail) => void;
onCheck?: (detail: KazuEventDetail) => void;
onSolve?: (detail: KazuEventDetail) => void;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
kind | "number-place" | "jigsaw" | "diagonal" | "sum-cages" | "more-or-less" | "towers" | |
size | number | |
givens | string | The puzzle's givens code. |
solution (省略可) | string | undefined | The puzzle's one answer, as a cells code. Left out, it is worked out from the givens when Hint or Check needs it. |
level (省略可) | "easy" | "medium" | "hard" | undefined | Which level and seed made it, to carry in the events. |
seed (省略可) | number | undefined | |
run (省略可) | string | undefined | A run to start from: the entries of a puzzle half done ( |
notes (省略可) | string | undefined | Pencil marks to start from ( |
elapsed (省略可) | number | undefined | Milliseconds already on the clock, to carry on a puzzle kept half done. |
clock (省略可) | boolean | undefined | Show the clock, which starts on the first entry. Default true. |
controls (省略可) | boolean | undefined | The number pad and the buttons under the board. Default true. |
hints (省略可) | "place" | "show" | "off" | undefined | What Hint does: |
check (省略可) | "show" | "off" | "count" | undefined | What Check does: |
conflicts (省略可) | boolean | undefined | Draw the cells that break a rule in red as they are made. Default true. |
peers (省略可) | boolean | undefined | Wash the chosen cell's row, column and group, and the cells holding its number. Default true. |
tidy (省略可) | boolean | undefined | A number written takes itself out of the pencil marks of the cells it shares a group with. Default true. |
tapToStep (省略可) | boolean | undefined | A tap on the chosen cell steps its number on. Default true. |
language (省略可) | KazuLanguage | undefined | The language the words are in. Left out, the host's own |
onChange (省略可) | ((detail: KazuEventDetail) => void) | undefined | |
onHint (省略可) | ((detail: KazuEventDetail) => void) | undefined | |
onCheck (省略可) | ((detail: KazuEventDetail) => void) | undefined | |
onSolve (省略可) | ((detail: KazuEventDetail) => void) | undefined |
例
import type { KazuPuzzle } from "@johnmorrisdotca/kazu";
import { decodeCells } from "@johnmorrisdotca/kazu";
import type { KazuMountOptions } from "@johnmorrisdotca/kazu/play";
const puzzle: KazuPuzzle = {"kind":"number-place","size":4,"level":"easy","seed":42,"givens":"14..2..1412.3..4","solution":"1432234141233214"};
const kind = puzzle.kind;
const size = puzzle.size;
const givens = puzzle.givens;
const answer = puzzle.solution;
const solution = decodeCells(answer,size)!;
const value: KazuMountOptions = {kind,size,givens,solution:answer,hints:"show"};
console.log(value);{
kind: 'number-place',
size: 4,
givens: '14..2..1412.3..4',
solution: '1432234141233214',
hints: 'show'
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。