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

windingLinesfunction

Every cell of the board in lines of at least three cells, none beside itself: one winding path, cut as it grows. When a line stops, the next starts beside its tip if a cell is free there, and otherwise in the tightest place left. A piece too short to be a line is handed to a line beside it; failing that the last few lines are taken back and grown again. Null where that did not settle.

Import it

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

Definition

function windingLines(board: TsunagiBoard, random: Random, longest: number): number[][] | null

Parameters

NameTypeDescription
boardTsunagiBoard

The board as a graph.

randomRandom

A reproducible random source returning values in [0,1).

longestnumber

The longest a line may grow, in cells.

Returns

number[][] | null

The lines, as lists of cells, or null.

Examples

import { seededRandom, squareBoard, windingLines } from "@johnmorrisdotca/tsunagi";

console.log(windingLines(squareBoard(5),seededRandom(42),15)?.flat().length);
25

What it prints (run when this page was built)

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