Skip to the content

Tsunagi繋ぎ

Join each pair with a separate line and fill the board, through fixed levels or seeded puzzles.

Tsunagi means joining in Japanese. About the name

Contents

Reference · Rules, solvers and generation

TsunagiBoardtype

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 it

import type { TsunagiBoard } from "@johnmorrisdotca/tsunagi";

Definition

type TsunagiBoard = {
    size: number;
    hex: boolean;
    wrap: boolean;
    shape: boolean;
    closed: ReadonlySet<number>;
    blocked: ReadonlySet<number>;
    cells: readonly number[];
    around: readonly (readonly number[])[];
};

Members

NameTypeDescription
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.

Examples

import { squareBoard } from "@johnmorrisdotca/tsunagi";
import type { TsunagiBoard } from "@johnmorrisdotca/tsunagi";

const value: TsunagiBoard = squareBoard(5);
console.log(value.cells.length);
25

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tsunagi 1.9.0.