本文へ移動

Houseki宝石

5つの宝石と石のゲームの仕組みを使い、測定したチャレンジやレッスンで遊び、再現できるゲームを保存できます。

宝石(ほうせき)は、宝石や貴石を意味する日本語です。 名前について(英語)

目次

リファレンス · ストーンコラプス

ChallengeOptions型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Authored challenge inputs including the starting board, finite goal and supplied witness.

インポート

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

定義

interface ChallengeOptions {
    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[])[];
}

メンバー

名前型説明
idstring
widthnumber
heightnumber
colourCount4 | 5 | 6
seed (省略可)string | number | undefined
mask (省略可)readonly boolean[] | undefined
initialBoardreadonly (Stone | null)[]
goalChallengeGoal
moveLimit (省略可)number | undefined
witnessreadonly (readonly number[])[]

例

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

const state=createGame({seed:"docs"});
const value: ChallengeOptions = {id:"docs",width:6,height:6,colourCount:4,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', 'initialBoard', 'goal' ]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/houseki 0.4.2 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。