Crates.io | shiritori |
lib.rs | shiritori |
version | 0.1.1 |
source | src |
created_at | 2022-05-07 07:01:27.594534 |
updated_at | 2022-05-08 14:49:14.669429 |
description | Japanse shiritori game |
homepage | |
repository | https://github.com/tnantoka/shiritori-rs/ |
max_upload_size | |
id | 581994 |
size | 15,096,014 |
Shiritori is a famous word chain game in Japan.
https://tnantoka.github.io/shiritori-wasm/
shiritori = { git = "https://github.com/tnantoka/shiritori-rs.git" }
# for Wasm
getrandom = { version = "0.2.6", features = ["js"] }
use shiritori::game::{Game};
use shiritori::word::{WordList, WordListType};
let word_list = WordList::load(WordListType::Pokemon);
let mut game = Game::new(word_list);
game.current_turn(); # Word { text: "ピカチュウ", reading: "ピカチユウ" }
let judgement = game.next_turn("ウーラオス");
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
# pretty
$ cargo run --bin generate -- -p