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
| Name | Type | Description |
|---|---|---|
pool | readonly Word[] | Any words with a |
played | readonly 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)