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

wordScorefunction

rows is how many guesses the puzzle gives (guessesFor), which sets every weight.

Import it

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

Definition

function wordScore(hidden: string, guesses: readonly string[], rows: number, elapsedMs: number): WordScore

Parameters

NameTypeDescription
hiddenstring

The hidden word in native lowercase letters or kana.

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

WordScore

rows is how many guesses the puzzle gives (guessesFor), which sets every weight.

Examples

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

console.log(wordScore("apple",["alley","apple"],6,20000));
{ placed: 260, elsewhere: 0, found: 400, speed: 50, total: 710 }

What it prints (run when this page was built)

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