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

keyMarksfunction

The best mark each letter has earned across the guesses, for colouring a keyboard: a hit beats near beats miss. Kana have no such keyboard, so a kana round answers with nothing.

Import it

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

Definition

function keyMarks(game: WordGame): Map<string, LetterMark>

Parameters

NameTypeDescription
gameWordGame

The current immutable word-game state.

Returns

Map<string, LetterMark>

The best mark each letter has earned across the guesses, for colouring a keyboard: a hit beats near beats miss. Kana have no such keyboard, so a kana round answers with nothing.

Examples

import { keyMarks, readWordLists, startWordGame, submitWordGame, typeWordGame } from "@johnmorrisdotca/kotoba";
import { EN_WORDS } from "@johnmorrisdotca/kotoba/words-en";

const wordLists = readWordLists(EN_WORDS,5)!;
const game = startWordGame("en",5,"apple");
const typed = [..."apple"].reduce((state,key)=>typeWordGame(state,key,1000),game);
const submitted = submitWordGame(typed,wordLists,20000);
console.log([...keyMarks(submitted.game)]);
[ [ 'a', 'hit' ], [ 'p', 'hit' ], [ 'l', 'hit' ], [ 'e', 'hit' ] ]

What it prints (run when this page was built)

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