Reference · Rules, tiles and records
kumimojiToJSONfunction
A game as JSON, two spaces deep, with the format's number first. kumimojiFromJSON reads it back.
Import it
import { kumimojiToJSON } from "@johnmorrisdotca/kumimoji";
Definition
function kumimojiToJSON(saved: KumimojiSaved): string
Parameters
| Name | Type | Description |
|---|---|---|
saved | KumimojiSaved | The original deal, current progress and elapsed time. |
Returns
string
A game as JSON, two spaces deep, with the format's number first. kumimojiFromJSON reads it back.
Examples
import { deal, generateKumimoji, kumimojiToJSON } from "@johnmorrisdotca/kumimoji";
import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
await loadTileWordsFromModule("english");
const play = deal("catdog",3);
const dealt = generateKumimoji(3,"hard",44);
const saved = {deal:dealt,play:deal(dealt.givens,dealt.size),elapsedMs:0};
console.log(kumimojiToJSON(saved));{
"format": 1,
"game": "kumimoji",
"generator": "kumimoji 1.6.0",
"size": 3,
"level": "hard",
"seed": 44,
"language": "english",
"gameLength": "short",
"doubleSet": false,
"diagonals": false,
"progress": "3::nwo:",
"elapsedMs": 0
}What it prints (run when this page was built)