本文へ移動

Tsunagi繋ぎ

同じ印の2つを別々の線で結び、盤を埋めます。収録された問題やシード付きの問題で遊べます。

「つなぎ」は、物をつなぐことを表す言葉です。 名前について(英語)

目次

リファレンス · ルール・解法・生成

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[])[];
};

メンバー

名前型説明
sizenumber

The side of the square it is written in.

hexboolean
wrapboolean
shapeboolean

Whether it says shape: some of its square is off the board.

closedReadonlySet<number>

The cells of the square no line may stand on: off the board, and blocked.

blockedReadonlySet<number>

Those inside the board, which are drawn as blocked.

cellsreadonly number[]

The cells a line may stand on, in reading order.

aroundreadonly (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

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

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

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