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

portalExitfunction

The cell a line comes out at after stepping from from into portal cell into: beyond the other portal, the same way on; -1 where there is none (off the board, or across a wall).

Import it

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

Definition

function portalExit(layout: LinkLayout, from: number, into: number): number

Parameters

NameTypeDescription
layoutLinkLayout

The decoded native board and its rule settings.

fromnumber

The preceding cell of a portal step.

intonumber

The cell entered by the step.

Returns

number

The cell a line comes out at after stepping from from into portal cell into: beyond the other portal, the same way on; -1 where there is none (off the board, or across a wall).

Examples

import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { decodeLayout, portalExit } from "@johnmorrisdotca/tsunagi";

const givens = TSUNAGI_4[0][0];
const layout = decodeLayout(givens,4)!;
console.log(portalExit(layout,0,1));
-1

What it prints (run when this page was built)

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