Reference
Marking, scores and game rules
import { … } from "@johnmorrisdotca/kotoba";
8.2 kB minified and gzipped, with everything it imports (measured with esbuild)
Kotoba: word lists and the rules of word games, in English, French, German and Japanese. The lists themselves are entry points of their own, so a page loads only what it plays: see the README.
Exports
| Name | Kind | What it is |
|---|---|---|
ALPHABETS | constant | The letters each alphabet game's words are written in, as a character class. |
changeWordGame | function | The last kana typed made small or large again (つ and っ), or given the next mark (は, ば, ぱ). |
cycleMark | function | ゛゜: a kana's mark, round in turn — は → ば → ぱ → は, か → が → か, う → ゔ → う; a kana with no marked form stays. |
dailyIndex | function | Which of count words a day gets, from 0 to count - 1. |
DailyOptions | type | How a day's word is chosen. |
dailyWord | function | The word of a day: the same for everybody who asks about the same day of the same list. |
dayKey | function | The calendar day a moment falls on, as YYYY-MM-DD: in UTC unless an IANA time zone such as Asia/Tokyo is named. |
DayKey | type | A day's name: four digits of year, two of month and two of day, such as 2026-10-01. |
dayNumber | function | How many days after 1970-01-01 a day is, counting the calendar and nothing else: a day has no hours here. |
decodeGuesses | function | Guesses run together, size letters each, read back as a list; null for anything else. |
decodeHidden | function | A hidden word read back, in lower case, or null for one that is not size letters of the language's alphabet. |
encodeHidden | function | A hidden word as it is written down for a puzzle: in capitals. |
eraseWordGame | function | The last thing typed taken back: romaji not yet a kana first, then the last kana or letter. |
finishRomaji | function | At Enter: what was typed, with a last "n" read as ん and any other unfinished sound dropped. |
foundBonus | function | Finding the word: 10 for every place of every guess the board gives, so it grows with the board. |
GomojiLanguage | type | The alphabet games: English, French, German, and the pop-culture English list. |
guessMarks | function | How each place of a guess did against the hidden word. |
isDayKey | function | Whether the text is a real calendar date written YYYY-MM-DD, from the year 0000 to 9999. |
isKanaGame | function | Whether a round is played in kana. |
isSmall | function | Whether this kana is one of the supported small forms. |
KANA_COLUMN | constant | WHAT A KANA WORD SCORES, won or lost, on English's scale (wordScore) so the two boards read alike. |
KANA_SIZES | constant | The lengths the kana lists come in. |
kanaBase | function | A kana without its size or its mark: ぱ → は, っ → つ, ゔ → う. |
kanaFamily | function | The gojūon row a kana belongs to, by its base, or null for ー and anything that is no kana. |
kanaFound | function | Found: every place plain green — the right kana, the right size, the right mark. |
KanaMark | type | HOW A KANA GUESS IS COLOURED, by John's rules for Gomoji in kana (2026-09-25; the table is in docs/plans/other/WORD-04-kana.md): |
KanaMarked | type | One kana guess position with its native match and size/voicing differences. |
kanaScore | function | Score kana guesses using exact, elsewhere and same-family matches plus found and speed bonuses. |
KanaScore | type | The word-score components with the additional same-kana-family column component. |
kanaTone | function | Which mark a kana carries: none, ゛ or ゜. |
KanaWords | type | A kana list, read. |
KEYBOARD_ROWS | constant | THE PHYSICAL KEYBOARD DRAWN UNDER A GOMOJI GRID, by language: QWERTY for English, AZERTY for French (the same 26 plain letters English's keys carry, arranged the way a French keyboard is), and QWERTZ for German, with Ä, Ö and Ü carried as keys of their own — German's letters, not English's plus a fold. |
keyMarks | function | The best mark each letter has earned across the guesses, for colouring a keyboard: a hit beats near beats miss. |
KOTOBA_STRINGS | constant | Every string, in both languages. |
kotobaLanguage | function | The language a person asked for, by en or ja or a tag that begins with one: English for anything else. |
kotobaSay | function | A string with its braces filled in from values; a brace with no value is left as it is. |
KotobaStrings | type | The names of the strings. |
Language | type | The languages Kotoba speaks. |
LetterMark | type | How a guessed letter did: in its place, in the word elsewhere, or not in it. |
LONG_BAR | constant | The long-vowel bar, a character of its own. |
markGuess | function | Each letter of a guess marked against the hidden word, counting a letter only as often as the word holds it. |
markKanaGuess | function | A guess coloured against the word, place by place. |
Packed | type | A kana list as its entry point exports it: the JMdict release, an alphabet of kana and one character a kana for each, and the three lists written in those characters. |
PlaceMark | type | One place of a marked guess: how it did, and for kana whether its size or mark is wrong. |
readRomaji | function | What has been typed, as kana, and what is still being typed. |
readWordLists | function | One length of a list read into words, or null for a length the list does not have. |
startWordGame | function | A new round: nothing guessed, nothing typed. |
submitWordGame | function | The guess being typed sent in, now being the time in milliseconds. |
toggleSize | function | 小: a kana made small, or large again (つ ⇄ っ); one with no small form stays as it is. |
typeWordGame | function | One key typed, now being the time in milliseconds (the first key starts the clock). |
unpack | function | A packed kana list read into its words, size kana each. |
VERSION | constant | The package's version. |
WORD_GAME_ROWS | constant | The guesses a round gives unless said. |
WORD_SCORE | constant | WHAT A GOMOJI WORD SCORES, won or lost. |
WordData | type | An alphabet list as its entry point exports it: for each length, the easy answers, all the answers and every word that may be guessed, each a run of words between spaces. |
WordGame | type | A round. |
wordGameKeys | function | The keys a round accepts, by the character each types: the letters of the language's keyboard, and for kana the letters of romaji and the long-vowel bar. |
WordGameLanguage | type | The languages a round is played in: the alphabet ones and Japanese kana. |
WordGameRefusal | type | Why a guess was not taken: it was too short, or the list does not have the word. |
WordGameStatus | type | How a round stands: still being played, found, or out of guesses. |
WordGameSubmit | type | A guess sent in: the round after it, and why the guess was not taken, if it was not. |
WordGameWords | type | The words a round may be guessed from. |
WordListLanguage | type | The languages with a dictionary of their own: English, French and German. |
WordLists | type | One length of an alphabet list, read: the easy answers, every answer, and the words that may be guessed. |
wordScore | function | rows is how many guesses the puzzle gives (guessesFor), which sets every weight. |
WordScore | type | The placed-letter, elsewhere-letter, found-word and speed components and their total. |