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 · Magnetic Blocks

Blocktype

The native active 2×2 block, orientation and fixed-tick descent/lock counters.

Import it

import type { Block } from "@johnmorrisdotca/houseki/magnetic-blocks";

Definition

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

Members

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

Examples

import { createGame } from "@johnmorrisdotca/houseki/magnetic-blocks";
import type { Block } from "@johnmorrisdotca/houseki/magnetic-blocks";

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

What it prints (run when this page was built)

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