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

Piecetype

The native falling triplet with stable gem ids, orientation, descent and lock counters.

Import it

import type { Piece } from "@johnmorrisdotca/houseki/falling-triplets";

Definition

interface Piece {
    readonly gems: readonly [
        Gem,
        Gem,
        Gem
    ];
    readonly x: number;
    readonly y: number;
    readonly orientation: 0 | 1 | 2;
    readonly level: number;
    readonly descent: number;
    readonly lockTicks: number;
    readonly lockResets: number;
    readonly lockStarted: boolean;
}

Members

NameTypeDescription
gemsreadonly [Gem, Gem, Gem]
xnumber
ynumber
orientation0 | 2 | 1
levelnumber
descentnumber
lockTicksnumber
lockResetsnumber
lockStartedboolean

Examples

import { createGame } from "@johnmorrisdotca/houseki/falling-triplets";
import type { Piece } from "@johnmorrisdotca/houseki/falling-triplets";

const state=createGame({seed:"docs"});
const value: Piece = state.active!;
console.log(value == null ? value : typeof value === "object" ? Object.keys(value).slice(0,6) : value);
[ 'gems', 'x', 'y', 'orientation', 'level', 'descent' ]

What it prints (run when this page was built)

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