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

guessMarksfunction

How each place of a guess did against the hidden word. For letters wrongSize and wrongMark are false.

Import it

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

Definition

function guessMarks(game: Pick<WordGame, "language" | "hidden">, guess: string): PlaceMark[]

Parameters

NameTypeDescription
gamePick<WordGame, "hidden" | "language">

The current immutable word-game state.

guessstring

The guessed word or kana array, with the same length as the hidden word.

Returns

PlaceMark[]

How each place of a guess did against the hidden word. For letters wrongSize and wrongMark are false.

Examples

import { guessMarks, startWordGame } from "@johnmorrisdotca/kotoba";

const game = startWordGame("en",5,"apple");
console.log(guessMarks(game,"alley"));
[
  { mark: 'hit', wrongSize: false, wrongMark: false },
  { mark: 'near', wrongSize: false, wrongMark: false },
  { mark: 'miss', wrongSize: false, wrongMark: false },
  { mark: 'near', wrongSize: false, wrongMark: false },
  { mark: 'miss', wrongSize: false, wrongMark: false }
]

What it prints (run when this page was built)

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