本文へ移動

Tsunagi繋ぎ

同じ印の2つを別々の線で結び、盤を埋めます。収録された問題やシード付きの問題で遊べます。

「つなぎ」は、物をつなぐことを表す言葉です。 名前について(英語)

目次

リファレンス · 遊べる盤

TsunagiMount型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

インポート

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

定義

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;
};

メンバー

名前型説明
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.

例

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();

ソースを見るGitHub で編集@johnmorrisdotca/tsunagi 1.7.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。