Reference · Marking, scores and game rules
WordGameSubmittype
A guess sent in: the round after it, and why the guess was not taken, if it was not.
Import it
import type { WordGameSubmit } from "@johnmorrisdotca/kotoba";
Definition
type WordGameSubmit = {
game: WordGame;
refused: WordGameRefusal | null;
};
Members
| Name | Type | Description |
|---|---|---|
game | WordGame | |
refused | WordGameRefusal | null |
Examples
import { readWordLists, startWordGame, submitWordGame, typeWordGame } from "@johnmorrisdotca/kotoba";
import { EN_WORDS } from "@johnmorrisdotca/kotoba/words-en";
import type { WordGameSubmit } from "@johnmorrisdotca/kotoba";
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);
const value: WordGameSubmit = submitted;
console.log(value);{
game: {
language: 'en',
size: 5,
rows: 6,
hidden: 'apple',
guesses: [ 'apple' ],
typed: [],
pending: '',
status: 'won',
startedAt: 1000,
score: { placed: 300, elsewhere: 0, found: 425, speed: 50, total: 775 }
},
refused: null
}What it prints (run when this page was built)