Skip to the content

Houseki宝石

Run five native gem and stone engines, play measured challenges and lessons, and save deterministic games.

Houseki (宝石) is Japanese for a gem or precious stone. About the name

Contents

Reference · Falling Triplets

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

NameTypeDescription
game"falling-triplets"
rules"triplets-1"
settingsSettings
boardreadonly (Gem | null)[]
phasePhase
pausedPhase (optional)Phase | undefined
activePiece | null
nextreadonly Triplet[]
bagreadonly Colour[]
randomStatenumber
nextIdnumber
scorenumber
maxChainnumber
completedPiecesnumber
elapsedTicksnumber
pieceTicksnumber
resolutionTicknumber
wavesreadonly Wave[]
assistedboolean
hintsUsednumber
witnessPathMatchesboolean
challengeIndex (optional)number | undefined
pendingClear (optional)readonly number[] | undefined
gravityBoard (optional)readonly (Gem | null)[] | undefined
resolutionChain (optional)number | undefined
resolutionLevel (optional)number | undefined
recordingreadonly 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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/houseki 0.4.2.