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
| Name | Type | Description |
|---|---|---|
game | WordGame | 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)