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

TsunagiEventDetailtype

What a mounted board tells of itself in every event.

Import it

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

Definition

type TsunagiEventDetail = {
    lines: Lines;
    code: string;
    progress: TsunagiProgress;
    answer: string;
    helped: TsunagiHelp | null;
    explosion?: {
        kind: "boom" | "blast";
        cells: readonly number[];
    };
};

Members

NameTypeDescription
linesLines

The lines drawn so far.

codestring

The lines as a short code, to keep a game half played (decodeLines brings them back).

progressTsunagiProgress
answerstring

The answer the lines make, in the answer's spelling: what checkTsunagiAnswer takes.

helpedTsunagiHelp | null
explosion (optional){ kind: "boom" | "blast"; cells: readonly number[]; } | undefined

What happened, for tsunagi-explosion: boom or blast, and the cells it took a line out of.

Examples

import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { answerOf, decodeLayout, encodeLines, newTsunagiGame, noLines, tsunagiProgress } from "@johnmorrisdotca/tsunagi";
import type { TsunagiEventDetail } from "@johnmorrisdotca/tsunagi/play";

const givens = TSUNAGI_4[0][0];
const answer = TSUNAGI_4[0][1];
const layout = decodeLayout(givens,4)!;
const lines = noLines(layout);
const game = newTsunagiGame(givens,4,{answer,cheats:true})!;
const value: TsunagiEventDetail = {lines,code:encodeLines(layout,lines),progress:tsunagiProgress(game),answer:answerOf(layout,lines),helped:null};
console.log(value);
{
  lines: [ [], [], [], [] ],
  code: '................',
  progress: {
    pairs: 4,
    joined: 0,
    filled: 8,
    cells: 16,
    strokesLeft: null,
    strokeLimit: null,
    boomIn: null,
    strokes: 0,
    solved: false,
    outOfStrokes: false,
    helped: null
  },
  answer: 'A..AB..BC..CD..D',
  helped: null
}

What it prints (run when this page was built)

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