Reference · Marking, scores and game rules
changeWordGamefunction
The last kana typed made small or large again (つ and っ), or given the next mark (は, ば, ぱ). Letters have neither: nothing changes.
Import it
import { changeWordGame } from "@johnmorrisdotca/kotoba";
Definition
function changeWordGame(game: WordGame, change: "size" | "mark"): WordGame
Parameters
| Name | Type | Description |
|---|---|---|
game | WordGame | The current immutable word-game state. |
change | "mark" | "size" | Toggle the final kana size or cycle its voicing mark. |
Returns
WordGame
The last kana typed made small or large again (つ and っ), or given the next mark (は, ば, ぱ). Letters have neither: nothing changes.
Examples
import { changeWordGame, startWordGame, typeWordGame } from "@johnmorrisdotca/kotoba";
const game = startWordGame("en",5,"apple");
const typed = [..."apple"].reduce((state,key)=>typeWordGame(state,key,1000),game);
console.log(changeWordGame(startWordGame("ja",2,"はな"),"mark").typed);[]What it prints (run when this page was built)