本文へ移動

Tsunagi繋ぎ

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

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

目次

リファレンス · ルール・解法・生成

TsunagiGame型

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

The complete immutable puzzle state, current stroke, undo history and assistance flags.

インポート

import type { TsunagiGame } from "@johnmorrisdotca/tsunagi";

定義

type TsunagiGame = {
    layout: LinkLayout;
    givens: string;
    answer: string | null;
    lines: Lines;
    undo: readonly Lines[];
    strokes: number;
    drawing: number | null;
    before: Lines | null;
    reach: Reach;
    flagged: readonly number[] | null;
    blasted: readonly number[] | null;
    exploded: "boom" | "blast" | null;
    checked: {
        unjoined: number;
        empty: number;
    } | null;
    cheats: boolean;
    explosions: TsunagiExplosionChoice;
    eased: TsunagiHelp | null;
    cheated: boolean;
    solved: boolean;
};

メンバー

名前型説明
layoutLinkLayout

The layout as it is played: its explosions as chosen.

givensstring

The layout code the game was made from, which decides which line an explosion breaks.

answerstring | null
linesLines
undoreadonly Lines[]

What Undo would give back, most recent last: up to 200.

strokesnumber

Strokes taken since the game started or was restarted.

drawingnumber | null

The pair being drawn this moment, or null between strokes.

beforeLines | null

The lines as they were when the pair being drawn was pressed.

reachReach

How far the finger is from the end of the line it draws, once that has been through a portal (Reach).

flaggedreadonly number[] | null

Pairs Check found not joined, until the board next changes.

blastedreadonly number[] | null

The cells the last explosion took a line out of, until the next press.

exploded"boom" | "blast" | null

What the last explosion did: boom (one line halved) or blast (a line wiped and its neighbour halved).

checked{ unjoined: number; empty: number; } | null

What Check said last, until the board changes: how many pairs are not joined, and how many cells are empty.

cheatsboolean
explosionsTsunagiExplosionChoice
easedTsunagiHelp | null

The help the explosions' choice amounts to on this board: softened or off, where the board has any; null otherwise.

cheatedboolean

Whether Cheat was used in this attempt.

solvedboolean

例

import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";
import { newTsunagiGame } from "@johnmorrisdotca/tsunagi";
import type { TsunagiGame } from "@johnmorrisdotca/tsunagi";

const givens = TSUNAGI_4[0][0];
const answer = TSUNAGI_4[0][1];
const game = newTsunagiGame(givens,4,{answer,cheats:true})!;
const value: TsunagiGame = game;
console.log(value);
{
  layout: {
    size: 4,
    cells: [
       0, -1, -1,  0,  1, -1,
      -1,  1,  2, -1, -1,  2,
       3, -1, -1,  3
    ],
    ends: [ [Array], [Array], [Array], [Array] ],
    walls: Set(0) {},
    waypoints: Map(0) {},
    wrap: false,
    portalPairs: [],
    portals: Map(0) {},
    hex: false,
    sparse: false,
    strokes: null,
    explosions: null
  },
  givens: 'A..AB..BC..CD..D',
  answer: 'AAAABBBBCCCCDDDD',
  lines: [ [], [], [], [] ],
  undo: [],
  strokes: 0,
  drawing: null,
  before: null,
  reach: { dr: 0, dc: 0 },
  flagged: null,
  blasted: null,
  exploded: null,
  checked: null,
  cheats: true,
  explosions: 'on',
  eased: null,
  cheated: false,
  solved: false
}

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

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

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