pub struct RandomGuesser { /* private fields */ }Expand description
Guesses at random from the possible words that meet the restrictions.
A sample benchmark against the data/improved-words.txt list performed as follows:
| Num guesses to win | Num games |
|---|---|
| 1 | 1 |
| 2 | 106 |
| 3 | 816 |
| 4 | 1628 |
| 5 | 1248 |
| 6 | 518 |
| 7 | 180 |
| 8 | 67 |
| 9 | 28 |
| 10 | 7 |
| 11 | 2 |
| 12 | 1 |
Average number of guesses: 4.49 +/- 1.26
Implementations§
Source§impl RandomGuesser
impl RandomGuesser
Sourcepub fn new(bank: WordBank) -> RandomGuesser
pub fn new(bank: WordBank) -> RandomGuesser
Constructs a new RandomGuesser using the given word bank.
This guesser always uses the GuessFrom::PossibleWords strategy by default.
use rs_wordle_solver::RandomGuesser;
use rs_wordle_solver::WordBank;
let bank = WordBank::from_iterator(&["abc", "def", "ghi"]).unwrap();
let guesser = RandomGuesser::new(bank);Trait Implementations§
Source§impl Clone for RandomGuesser
impl Clone for RandomGuesser
Source§fn clone(&self) -> RandomGuesser
fn clone(&self) -> RandomGuesser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RandomGuesser
impl Debug for RandomGuesser
Source§impl Guesser for RandomGuesser
impl Guesser for RandomGuesser
Source§fn update(&mut self, result: &GuessResult<'_>) -> Result<(), WordleError>
fn update(&mut self, result: &GuessResult<'_>) -> Result<(), WordleError>
Updates this guesser with information about a word.
Source§fn select_next_guess(&mut self) -> Option<Arc<str>>
fn select_next_guess(&mut self) -> Option<Arc<str>>
Selects a new guess for the Wordle. Read more
Source§fn select_next_guess_from(&mut self, from: GuessFrom) -> Option<Arc<str>>
fn select_next_guess_from(&mut self, from: GuessFrom) -> Option<Arc<str>>
Selects a new guess for the Wordle using the requested set of possible words instead of
the default set for this guesser. Read more
Source§fn possible_words(&self) -> &[Arc<str>]
fn possible_words(&self) -> &[Arc<str>]
Provides read access to the remaining set of possible words in this guesser.
Auto Trait Implementations§
impl Freeze for RandomGuesser
impl RefUnwindSafe for RandomGuesser
impl Send for RandomGuesser
impl Sync for RandomGuesser
impl Unpin for RandomGuesser
impl UnwindSafe for RandomGuesser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more