Skip to the content

Kumimoji組み文字

Build crosswords from seeded English or Japanese tile bags, alone or at a shared table.

Kumimoji means assembled characters in Japanese. About the name

Contents

Reference · Rules, tiles and records

tradeChoicefunction

The tile a computer trades: its rarest letter in the set, the first of those in its hand; never a wild. Null for a hand of wilds.

Import it

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

Definition

function tradeChoice(hand: readonly string[], words: TileWords): number | null

Parameters

NameTypeDescription
handreadonly string[]

The hand size or tile codes, as declared by the function signature.

wordsTileWords

The loaded native language word list and tile mappings.

Returns

number | null

The tile a computer trades: its rarest letter in the set, the first of those in its hand; never a wild. null for a hand of wilds.

Examples

import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
import { deal, tradeChoice } from "@johnmorrisdotca/kumimoji";

const words = await loadTileWordsFromModule("english");
const play = deal("catdog",3);
console.log(tradeChoice(play.hand,words));
0

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kumimoji 1.6.0.