TsunagiEventDetailtype
What a mounted board tells of itself in every event.
Import it
import type { TsunagiEventDetail } from "@johnmorrisdotca/tsunagi/play";
Definition
type TsunagiEventDetail = {
lines: Lines;
code: string;
progress: TsunagiProgress;
answer: string;
helped: TsunagiHelp | null;
explosion?: {
kind: "boom" | "blast";
cells: readonly number[];
};
};
Members
| Name | Type | Description |
|---|---|---|
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 (optional) | { kind: "boom" | "blast"; cells: readonly number[]; } | undefined | What happened, for |
Examples
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
}What it prints (run when this page was built)