Skip to the content

Kotoba言葉

Load only the word lists you need, mark repeated letters correctly and play a daily or seeded word game.

Kotoba is the Japanese word for words. About the name

Contents

Reference · Marking, scores and game rules

shiritoriChoicesfunction

The words of a pool that could be played next and do not lose, in the pool's own order.

Import it

import { shiritoriChoices } from "@johnmorrisdotca/kotoba";

Definition

function shiritoriChoices<Word extends { readonly reading: string; }>(pool: readonly Word[], played: readonly string[], rules?: ShiritoriRules): Word[]

Parameters

NameTypeDescription
poolreadonly Word[]

Any words with a reading; the list's are commonest first.

playedreadonly string[]

The readings so far, oldest first.

rules (optional)ShiritoriRules

House rules; the forgiving ones if left out.

Returns

Word[]

The playable words, which may be none: that is how a chain ends without a ん.

Examples

import { shiritoriChoices } from "@johnmorrisdotca/kotoba";

console.log(shiritoriChoices([{ reading: "らくだ" }, { reading: "らいおん" }], ["さくら"]));
[ { reading: 'らくだ' } ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kotoba 1.11.0.