Shiritori is a famous word chain game in Japan.
https://tnantoka.github.io/shiritori-wasm/
``` shiritori = { git = "https://github.com/tnantoka/shiritori-rs.git" }
getrandom = { version = "0.2.6", features = ["js"] } ```
```rust use shiritori::game::{Game}; use shiritori::word::{WordList, WordListType};
let wordlist = WordList::load(WordListType::Pokemon); let mut game = Game::new(wordlist);
game.currentturn(); # Word { text: "ピカチュウ", reading: "ピカチユウ" } let judgement = game.nextturn("ウーラオス"); game.current_turn(); # Word { text: "スイクン", reading: "スクイン" }
judgement.game_over # true judgement.winner # Player::You judgement.reason # Reason::LastLetterIsInvalid ```
``` $ cargo run --example hello pokemon
bot> ピカチュウ(ピカチユウ) next: ウ you> ウーラオス bot> スイクン(スイクン) You win (last letter is invalid) ```
``` $ cargo run --bin generate
$ cargo run --bin generate -- -p ```