本文へ移動

Suido水道

管を回してポンプと排水口をつなぎます。収録された問題やシード付きの問題で遊べます。

「水道」は、水を届ける設備を表す言葉です。 名前について(英語)

目次

リファレンス · 遊べる盤

SuidoMount型

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

The native mounted board, its game and view, actions and cleanup methods.

インポート

import type { SuidoMount } from "@johnmorrisdotca/suido/play";

定義

type SuidoMount = {
    readonly host: HTMLElement;
    game: () => Game;
    flow: () => Flow;
    progress: () => string;
    load: (board: {
        code: string;
        answer?: string;
        progress?: string;
        shown?: boolean;
    }) => void;
    set: (changes: {
        turning?: SuidoTurning;
        hints?: boolean;
        language?: SuidoLanguage;
    }) => void;
    turn: (cell: number, back?: boolean) => void;
    restart: () => void;
    hint: () => void;
    view: () => SuidoView;
    zoom: (how: "in" | "out" | "fit") => void;
    destroy: () => void;
};

メンバー

名前型説明
hostHTMLElement
game() => Game

The game as it stands.

flow() => Flow

The water as it runs now.

progress() => string

The game half played, as a short string to keep.

load(board: { code: string; answer?: string; progress?: string; shown?: boolean; }) => void

Play another board (or the same one again, fresh). progress carries on a kept game and shown opens on the answer.

set(changes: { turning?: SuidoTurning; hints?: boolean; language?: SuidoLanguage; }) => void

Change how it is played: the turning, whether Hint is offered, the language.

turn(cell: number, back?: boolean) => void

Turn the piece on a cell, a quarter clockwise or (back) the other way, as a tap does.

restart() => void

Start the board over: every piece as given, no turns, no hints.

hint() => void

Light a piece to turn, as the Hint button does.

view() => SuidoView

The view of the board: how far in it is, and where. Whole (zoom 1) unless it has been zoomed.

zoom(how: "in" | "out" | "fit") => void

Zoom the board in or out a step, or back to the whole of it, as the buttons do.

destroy() => void

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

例

import { SUIDO_5X5 } from "@johnmorrisdotca/suido/levels-5x5";
import { levelAnswer } from "@johnmorrisdotca/suido/levels";
import type { SuidoMount } from "@johnmorrisdotca/suido/play";
import { mountSuido } from "@johnmorrisdotca/suido/play";

const row = SUIDO_5X5[0];
const code = row[0];
const answer = levelAnswer(row)!;
const host = document.createElement("div");
document.body.append(host);
const board: SuidoMount | null = mountSuido(host,{code,answer,controls:true});
console.log(board?.progress());
board?.destroy();

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

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