Reference · Marking, scores and game rules
WordGametype
A round.
Import it
import type { WordGame } from "@johnmorrisdotca/kotoba";
Definition
type WordGame = {
language: WordGameLanguage;
size: number;
rows: number;
hidden: string;
guesses: readonly string[];
typed: readonly string[];
pending: string;
status: WordGameStatus;
startedAt: number | null;
score: WordScore | null;
};
Members
| Name | Type | Description |
|---|---|---|
language | WordGameLanguage | |
size | number | How many letters, or kana, the word has. |
rows | number | How many guesses the round gives. |
hidden | string | The word to find. |
guesses | readonly string[] | The guesses made, each a whole word. |
typed | readonly string[] | The letters, or kana, of the guess being typed. |
pending | string | Romaji typed and not yet a kana: |
status | WordGameStatus | |
startedAt | number | null | When the first key was pressed, in milliseconds, or null before it. |
score | WordScore | null | The score, once the round is over. |
Examples
import { startWordGame } from "@johnmorrisdotca/kotoba";
import type { WordGame } from "@johnmorrisdotca/kotoba";
const game = startWordGame("en",5,"apple");
const value: WordGame = game;
console.log(value);{
language: 'en',
size: 5,
rows: 6,
hidden: 'apple',
guesses: [],
typed: [],
pending: '',
status: 'playing',
startedAt: null,
score: null
}What it prints (run when this page was built)