TsunagiBoard型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
THE BOARD A GENERATOR WORKS ON, as a graph: which cells a line may stand on, and
which cells each is beside. A square, an oblong, a honeycomb, a board whose edges
join and a board of any outline are all this one thing, so one generator
(generator.ts) makes all of them.
Every board is still written as a square of cells (code.ts), and one that is not
the whole of its square says shape, so a level is read, solved and checked by what
has always read, solved and checked levels.
Imports carry their .ts so a level script can run this under plain node.
インポート
import type { TsunagiBoard } from "@johnmorrisdotca/tsunagi";
定義
type TsunagiBoard = {
size: number;
hex: boolean;
wrap: boolean;
shape: boolean;
closed: ReadonlySet<number>;
blocked: ReadonlySet<number>;
cells: readonly number[];
around: readonly (readonly number[])[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
size | number | The side of the square it is written in. |
hex | boolean | |
wrap | boolean | |
shape | boolean | Whether it says |
closed | ReadonlySet<number> | The cells of the square no line may stand on: off the board, and blocked. |
blocked | ReadonlySet<number> | Those inside the board, which are drawn as blocked. |
cells | readonly number[] | The cells a line may stand on, in reading order. |
around | readonly (readonly number[])[] | What is beside each cell of the square: only cells a line may stand on. |
例
import { squareBoard } from "@johnmorrisdotca/tsunagi";
import type { TsunagiBoard } from "@johnmorrisdotca/tsunagi";
const value: TsunagiBoard = squareBoard(5);
console.log(value.cells.length);25出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。