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 · Stone Collapse

ChallengeDefinitiontype

A validated Stone Collapse authored setup and stable-id group witness.

Import it

import type { ChallengeDefinition } from "@johnmorrisdotca/houseki/stone-collapse";

Definition

interface ChallengeDefinition {
    readonly id: string;
    readonly width: number;
    readonly height: number;
    readonly colourCount: 4 | 5 | 6;
    readonly seed: string | number;
    readonly mask: readonly boolean[];
    readonly initialBoard: readonly (Stone | null)[];
    readonly goal: ChallengeGoal;
    readonly moveLimit?: number;
    readonly witness: readonly (readonly number[])[];
}

Members

NameTypeDescription
idstring
widthnumber
heightnumber
colourCount4 | 5 | 6
seedstring | number
maskreadonly boolean[]
initialBoardreadonly (Stone | null)[]
goalChallengeGoal
moveLimit (optional)number | undefined
witnessreadonly (readonly number[])[]

Each entry is the complete stable-ID set of the next witnessed group.

Examples

import { createGame } from "@johnmorrisdotca/houseki/stone-collapse";
import type { ChallengeDefinition } from "@johnmorrisdotca/houseki/stone-collapse";

const state=createGame({seed:"docs"});
const value: ChallengeDefinition = {id:"docs",width:state.settings.width,height:state.settings.height,colourCount:4,seed:"docs",mask:state.settings.mask,initialBoard:state.board,goal:{kind:"clear-all"},witness:[]};
console.log(value == null ? value : typeof value === "object" ? Object.keys(value).slice(0,6) : value);
[ 'id', 'width', 'height', 'colourCount', 'seed', 'mask' ]

What it prints (run when this page was built)

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