decodeGame関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Validates and reconstructs a state by replay; serialized board snapshots are never trusted.
インポート
import { decodeGame } from "@johnmorrisdotca/houseki/gem-swap";
定義
function decodeGame(serialized: string): GameState
引数
| 名前 | 型 | 説明 |
|---|---|---|
serialized | string | A saved JSON recording from this entry’s encodeGame; malformed or inconsistent saves throw. |
戻り値
GameState
Validates and reconstructs a state by replay; serialized board snapshots are never trusted.
例
import { createGame, decodeGame, encodeGame } from "@johnmorrisdotca/houseki/gem-swap";
const state=createGame({seed:"docs"});
console.log(decodeGame(encodeGame(state)).phase);ready出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。