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

hexNeighboursOffunction

The six neighbours of a cell on the hexagon lattice, as indexes; fewer at an edge of the square (the hexagon's own edge is its # cells).

Import it

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

Definition

function hexNeighboursOf(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 six neighbours of a cell on the hexagon lattice, as indexes; fewer at an edge of the square (the hexagon's own edge is its # cells).

Examples

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

console.log(hexNeighboursOf(7,24));
[ 17, 18, 25, 31, 30, 23 ]

What it prints (run when this page was built)

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