generated from PlexSheep/rs-base
we have a solver that solves every wordle with enough steps
cargo devel CI / cargo CI (push) Successful in 40s
Details
cargo devel CI / cargo CI (push) Successful in 40s
Details
This commit is contained in:
parent
5ef63d4147
commit
f24f83ad64
|
@ -12,7 +12,7 @@ impl<'wl, WL: WordList> Solver<'wl, WL> for StupidSolver<'wl, WL> {
|
|||
fn build(wordlist: &'wl WL) -> crate::error::WResult<Self> {
|
||||
Ok(Self { wl: wordlist })
|
||||
}
|
||||
fn guess_for(&self, game: &crate::game::Game<'wl, WL>) -> Word {
|
||||
Word::from("hello")
|
||||
fn guess_for(&self, game: &crate::game::Game<WL>) -> Word {
|
||||
self.wl.rand_word().0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,11 @@ pub trait WordList: Clone + std::fmt::Debug + Default {
|
|||
let sol = *self.solutions().iter().choose(&mut rng).unwrap();
|
||||
(sol.0.to_owned(), sol.1.to_owned())
|
||||
}
|
||||
fn rand_word(&self) -> WordData {
|
||||
let mut rng = rand::thread_rng();
|
||||
let w = self.wordmap().iter().choose(&mut rng).unwrap();
|
||||
(w.0.clone(), *w.1)
|
||||
}
|
||||
fn length_range(&self) -> impl RangeBounds<usize>;
|
||||
fn amount(&self) -> usize {
|
||||
self.solutions().len()
|
||||
|
|
Loading…
Reference in New Issue