GameStatetype
The immutable authoritative native game state, including its board, random state and recording.
Import it
import type { GameState } from "@johnmorrisdotca/houseki/falling-triplets";
Definition
interface GameState {
readonly game: 'falling-triplets';
readonly rules: 'triplets-1';
readonly settings: Settings;
readonly board: readonly (Gem | null)[];
readonly phase: Phase;
readonly pausedPhase?: Phase;
readonly active: Piece | null;
readonly next: readonly Triplet[];
readonly bag: readonly Colour[];
readonly randomState: number;
readonly nextId: number;
readonly score: number;
readonly maxChain: number;
readonly completedPieces: number;
readonly elapsedTicks: number;
readonly pieceTicks: number;
readonly resolutionTick: number;
readonly waves: readonly Wave[];
readonly assisted: boolean;
readonly hintsUsed: number;
readonly witnessPathMatches: boolean;
readonly challengeIndex?: number;
readonly pendingClear?: readonly number[];
readonly gravityBoard?: readonly (Gem | null)[];
readonly resolutionChain?: number;
readonly resolutionLevel?: number;
readonly recording: readonly RecordedAction[];
readonly reason?: string;
}
Members
| Name | Type | Description |
|---|---|---|
game | "falling-triplets" | |
rules | "triplets-1" | |
settings | Settings | |
board | readonly (Gem | null)[] | |
phase | Phase | |
pausedPhase (optional) | Phase | undefined | |
active | Piece | null | |
next | readonly Triplet[] | |
bag | readonly Colour[] | |
randomState | number | |
nextId | number | |
score | number | |
maxChain | number | |
completedPieces | number | |
elapsedTicks | number | |
pieceTicks | number | |
resolutionTick | number | |
waves | readonly Wave[] | |
assisted | boolean | |
hintsUsed | number | |
witnessPathMatches | boolean | |
challengeIndex (optional) | number | undefined | |
pendingClear (optional) | readonly number[] | undefined | |
gravityBoard (optional) | readonly (Gem | null)[] | undefined | |
resolutionChain (optional) | number | undefined | |
resolutionLevel (optional) | number | undefined | |
recording | readonly RecordedAction[] | |
reason (optional) | string | undefined |
Examples
import { createGame } from "@johnmorrisdotca/houseki/falling-triplets";
import type { GameState } from "@johnmorrisdotca/houseki/falling-triplets";
const state=createGame({seed:"docs"});
const value: GameState = state;
console.log(value == null ? value : typeof value === "object" ? Object.keys(value).slice(0,6) : value);[ 'game', 'rules', 'settings', 'board', 'phase', 'active' ]What it prints (run when this page was built)