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

absorbfunction

Joins a short run of cells onto the end of a line beside it, keeping every line clear of itself.

Import it

import { absorb } from "@johnmorrisdotca/tsunagi";

Definition

function absorb(run: number[], paths: number[][], owner: Int16Array, around: readonly (readonly number[])[]): boolean

Parameters

NameTypeDescription
runnumber[]

The short run of cells.

pathsnumber[][]

The lines so far, one of which may take it.

ownerInt16Array<ArrayBufferLike>

Which line owns each cell.

aroundreadonly (readonly number[])[]

What is beside each cell.

Returns

boolean

Whether a line took it.

Examples

import { absorb } from "@johnmorrisdotca/tsunagi";

const owner = new Int16Array(4).fill(-1);
owner[0] = owner[1] = owner[2] = 0;
console.log(absorb([3],[[0,1,2]],owner,[[1],[0,2],[1,3],[2]]));
true

What it prints (run when this page was built)

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