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[];
};
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
lines | Lines | The lines drawn so far. |
code | string | The lines as a short code, to keep a game half played ( |
progress | TsunagiProgress | |
answer | string | The answer the lines make, in the answer's spelling: what |
helped | TsunagiHelp | null | |
explosion (省略可) | { kind: "boom" | "blast"; cells: readonly number[]; } | undefined | What happened, for |
例
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
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。