GameState型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The immutable authoritative native game state, including its board, random state and recording.
インポート
import type { GameState } from "@johnmorrisdotca/houseki/stone-collapse";
定義
interface GameState {
readonly game: 'stone-collapse';
readonly rules: 'collapse-2';
readonly settings: Settings;
readonly challenge: ChallengeDefinition | null;
readonly initialBoard: readonly (Stone | null)[];
readonly board: readonly (Stone | null)[];
readonly phase: GamePhase;
readonly selectedId: number | null;
readonly selectedIds: readonly number[];
readonly previewScore: number;
readonly score: number;
readonly moves: number;
readonly removed: number;
readonly randomState: number;
readonly nextId: number;
readonly usedFallback: boolean;
readonly resolutionTick: number;
readonly pendingIds: readonly number[];
readonly gravityBoard: readonly (Stone | null)[] | null;
readonly finishAdjustmentApplied: boolean;
readonly assisted: boolean;
readonly history: readonly UndoFrame[];
readonly witnessIndex: number;
readonly elapsedTicks: number;
readonly reason?: string;
readonly recording: readonly RecordedAction[];
readonly inventory: ToolInventory;
readonly toolProgress: number;
readonly toolAwardCursor: 0 | 1;
readonly selectedTool: StoredTool | null;
readonly toolTarget: number | null;
readonly toolPreview: readonly number[];
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
game | "stone-collapse" | |
rules | "collapse-2" | |
settings | Settings | |
challenge | ChallengeDefinition | null | |
initialBoard | readonly (Stone | null)[] | |
board | readonly (Stone | null)[] | Row-major; masked and currently empty cells contain null. |
phase | GamePhase | |
selectedId | number | null | |
selectedIds | readonly number[] | |
previewScore | number | |
score | number | |
moves | number | |
removed | number | |
randomState | number | |
nextId | number | |
usedFallback | boolean | |
resolutionTick | number | |
pendingIds | readonly number[] | |
gravityBoard | readonly (Stone | null)[] | null | Settled destination board held during the gravity animation. |
finishAdjustmentApplied | boolean | |
assisted | boolean | |
history | readonly UndoFrame[] | |
witnessIndex | number | -1 means the player's current board has left the supplied witness path. |
elapsedTicks | number | |
reason (省略可) | string | undefined | |
recording | readonly RecordedAction[] | |
inventory | ToolInventory | |
toolProgress | number | Ordinary removed stones carried toward the next tool award; always 0–11. |
toolAwardCursor | 0 | 1 | 0 awards Bomb next; 1 awards Pick next. |
selectedTool | StoredTool | null | |
toolTarget | number | null | |
toolPreview | readonly number[] | Exact row-major cells affected by the current target. |
例
import { createGame } from "@johnmorrisdotca/houseki/stone-collapse";
import type { GameState } from "@johnmorrisdotca/houseki/stone-collapse";
const state=createGame({seed:"docs"});
const value: GameState = state;
console.log(value == null ? value : typeof value === "object" ? Object.keys(value).slice(0,6) : value);[ 'game', 'rules', 'settings', 'challenge', 'initialBoard', 'board' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。