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

neighboursOffunction

The four neighbours of a cell on a square grid, as indexes; fewer at an edge.

Import it

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

Definition

function neighboursOf(size: number, at: number): number[]

Parameters

NameTypeDescription
sizenumber

The number of cells on each side of the board.

atnumber

The zero-based cell index.

Returns

number[]

The four neighbours of a cell on a square grid, as indexes; fewer at an edge.

Examples

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

console.log(neighboursOf(4,0));
[ 1, 4 ]

What it prints (run when this page was built)

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