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

shiritoriDistractorScorefunction

How tempting a word that does not continue the chain is, for a game offering wrong answers: 0 for a word that does continue, or holds no kana; 1 for any other; more for one that shares the vowel, or that ends where the chain stands.

Import it

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

Definition

function shiritoriDistractorScore(reading: string, chainKey: string, rules?: ShiritoriRules): number

Parameters

NameTypeDescription
readingstring

The reading of the wrong answer.

chainKeystring

The last word's tail key.

rules (optional)ShiritoriRules

House rules; the forgiving ones if left out.

Returns

number

The score: higher is harder to refuse at speed.

Examples

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

console.log(shiritoriDistractorScore("かわ", "さ"), shiritoriDistractorScore("きのこ", "さ"));
4 1

What it prints (run when this page was built)

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