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 · Gem Swap

validateChallengeWitnessfunction

Checks a complete authored witness through the public deterministic rules API.

Import it

import { validateChallengeWitness } from "@johnmorrisdotca/houseki/gem-swap";

Definition

function validateChallengeWitness(options: CreateOptions, witness: readonly ReplayOperation[]): { readonly valid: boolean; readonly state?: GameState; readonly reason?: string; }

Parameters

NameTypeDescription
optionsCreateOptions

Validated native creation, authored challenge, or environment options described by this signature.

witnessreadonly ReplayOperation[]

The ordered native replay operations proposed as a winning challenge proof.

Returns

{ readonly valid: boolean; readonly state?: GameState; readonly reason?: string; }

Checks a complete authored witness through the public deterministic rules API.

Examples

import { GEM_SWAP_CAMPAIGN, validateChallengeWitness } from "@johnmorrisdotca/houseki/gem-swap";

console.log(validateChallengeWitness(GEM_SWAP_CAMPAIGN[0].options,GEM_SWAP_CAMPAIGN[0].witness).valid);
true

What it prints (run when this page was built)

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