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;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
layout | LinkLayout | The layout as it is played: its explosions as chosen. |
givens | string | The layout code the game was made from, which decides which line an explosion breaks. |
answer | string | null | |
lines | Lines | |
undo | readonly Lines[] | What Undo would give back, most recent last: up to 200. |
strokes | number | Strokes taken since the game started or was restarted. |
drawing | number | null | The pair being drawn this moment, or null between strokes. |
before | Lines | null | The lines as they were when the pair being drawn was pressed. |
reach | Reach | How far the finger is from the end of the line it draws, once that has been through a portal ( |
flagged | readonly number[] | null | Pairs Check found not joined, until the board next changes. |
blasted | readonly 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: |
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. |
cheats | boolean | |
explosions | TsunagiExplosionChoice | |
eased | TsunagiHelp | null | The help the explosions' choice amounts to on this board: softened or off, where the board has any; null otherwise. |
cheated | boolean | Whether Cheat was used in this attempt. |
solved | boolean |
例
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
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。