本文へ移動

Tsunagi繋ぎ

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

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

目次

リファレンス · 遊べる盤

TsunagiEventDetail型

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

What a mounted board tells of itself in every event.

インポート

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

定義

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

メンバー

名前型説明
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 (省略可){ kind: "boom" | "blast"; cells: readonly number[]; } | undefined

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

例

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
}

出力(このページを作ったときに実行した結果)

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

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