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

kanaScorefunction

Score kana guesses using exact, elsewhere and same-family matches plus found and speed bonuses.

Import it

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

Definition

function kanaScore(word: string, guesses: readonly string[], rows: number, elapsedMs: number): KanaScore

Parameters

NameTypeDescription
wordstring

The word or kana array specified by this signature.

guessesreadonly string[]

Submitted whole guesses in chronological order.

rowsnumber

The number of guesses the game permits.

elapsedMsnumber

Elapsed milliseconds supplied by the host clock.

Returns

KanaScore

Score kana guesses using exact, elsewhere and same-family matches plus found and speed bonuses.

Examples

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

console.log(kanaScore("はな",["ぱな","はな"],6,20000));
{
  placed: 110,
  elsewhere: 0,
  column: 0,
  found: 220,
  speed: 50,
  total: 380
}

What it prints (run when this page was built)

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