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 · Playable board

TsunagiMounttype

The mounted native board handle and its game, display, action and cleanup methods.

Import it

import type { TsunagiMount } from "@johnmorrisdotca/tsunagi/play";

Definition

type TsunagiMount = {
    readonly host: HTMLElement;
    game: () => TsunagiGame;
    progress: () => TsunagiProgress;
    load: (level: {
        size: number;
        givens: string;
        answer?: string;
        level?: number;
        set?: TsunagiSet;
        lines?: Lines;
    }) => void;
    set: (changes: TsunagiLook & {
        explosions?: TsunagiExplosionChoice;
        cheats?: boolean;
        language?: TsunagiLanguage;
    }) => void;
    undo: () => void;
    restart: () => void;
    check: () => void;
    cheat: () => void;
    fit: () => void;
    destroy: () => void;
};

Members

NameTypeDescription
hostHTMLElement
game() => TsunagiGame

The game as it stands.

progress() => TsunagiProgress
load(level: { size: number; givens: string; answer?: string; level?: number; set?: TsunagiSet; lines?: Lines; }) => void

Play another level (or the same one again, fresh). lines carries on a kept game.

set(changes: TsunagiLook & { explosions?: TsunagiExplosionChoice; cheats?: boolean; language?: TsunagiLanguage; }) => void

Change how the board looks, or how it is played: marks, fill, colours, board, coordinates, explosions, cheats, language. A look takes effect at once; explosions and cheats from the next load or restart.

undo() => void
restart() => void
check() => void
cheat() => void
fit() => void

Zoom and move back to the whole board.

destroy() => void

Take the board down: its listeners, its timers and everything it put in the host.

Examples

import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import type { TsunagiMount } from "@johnmorrisdotca/tsunagi/play";
import { mountTsunagi } from "@johnmorrisdotca/tsunagi/play";

const givens = TSUNAGI_4[0][0];
const answer = TSUNAGI_4[0][1];
const host = document.createElement("div");
document.body.append(host);
const board: TsunagiMount | null = mountTsunagi(host,{size:4,givens,answer,controls:true});
console.log(board?.progress().pairs);
board?.destroy();

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