2 releases

0.1.1 May 8, 2022
0.1.0 May 7, 2022

#431 in Games

Download history 4/week @ 2024-09-18 7/week @ 2024-09-25 18/week @ 2024-10-02 2/week @ 2024-10-09 9/week @ 2024-11-27 70/week @ 2024-12-04 48/week @ 2024-12-11 7/week @ 2024-12-18

131 downloads per month

MIT license

2MB
402 lines

Shiritori-rs

Shiritori is a famous word chain game in Japan.

Live demo (Wasm)

https://tnantoka.github.io/shiritori-wasm/

Usage

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

Example

$ cargo run --example hello pokemon

bot> ピカチュウ(ピカチユウ)
next:
you> ウーラオス
bot> スイクン(スイクン)
You win
(last letter is invalid)

Development

Update word list

$ cargo run --bin generate

# pretty
$ cargo run --bin generate -- -p

Acknowledgments

Dependencies

~3–5MB
~93K SLoC