本文へ移動

Kumimoji組み文字

シードから配った英字やかなのタイルで、ひとりでも複数人の卓でも、単語を組み合わせて遊べます。

「組み文字」は文字を組み合わせることを表す言葉です。 名前について(英語)

目次

リファレンス · ルール・タイル・記録

kumimojiFromJSON関数

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

A game from JSON that kumimojiToJSON wrote. Nothing in it is trusted: the bag is dealt again from the seed, and the game opens only if every tile held is one that came out of that bag. Resolves to null when the text is not JSON, is of a later format than this version reads, is another game's, or holds a hand or a grid that this bag never dealt.

The word list of the game's language is loaded first, since dealing needs it; where there is no browser, import @johnmorrisdotca/kumimoji/words once, or the promise is rejected as loadTileWords rejects it.

インポート

import { kumimojiFromJSON } from "@johnmorrisdotca/kumimoji";

定義

function kumimojiFromJSON(text: string): Promise<KumimojiSaved | null>

引数

名前型説明
textstring

The saved JSON text to validate.

戻り値

Promise<KumimojiSaved | null>

A game from JSON that kumimojiToJSON wrote. Nothing in it is trusted: the bag is dealt again from the seed, and the game opens only if every tile held is one that came out of that bag. Resolves to null when the text is not JSON, is of a later format than this version reads, is another game's, or holds a hand or a grid that this bag never dealt.

例

import { deal, generateKumimoji, kumimojiFromJSON, 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((await kumimojiFromJSON(kumimojiToJSON(saved)))?.deal.seed);
44

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

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

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