Crates.io | wordler |
lib.rs | wordler |
version | 0.3.0 |
source | src |
created_at | 2022-02-07 01:45:21.637983 |
updated_at | 2022-02-07 07:33:05.351864 |
description | Library and cli for Wordle |
homepage | https://docs.rs/wordler |
repository | https://github.com/64bit/wordle-rs |
max_upload_size | |
id | 528117 |
size | 839,017 |
A Rust library and cli for Wordle. Inspired by Wordle in Bash
cargo install wordler
wordler
use wordler::dictionary::EnglishDictionary;
use wordler::wordle::{Wordle, PlayResult};
let dictionary = EnglishDictionary::new().unwrap();
let mut wordle = Wordle::new(&dictionary);
let play_result = wordle.play("dream");
match play_result {
Ok(play_result) => {
println!("{}", play_result);
match play_result {
PlayResult::YouWon(_) => std::process::exit(0),
PlayResult::YouLost(_, _) => std::process::exit(1),
PlayResult::TurnResult(_) => {}
}
}
Err(e) => println!("{}", e),
}