be even a little more adversarial
This commit is contained in:
parent
4dd91ad03c
commit
6a75cd777b
1 changed files with 11 additions and 1 deletions
|
@ -87,7 +87,17 @@ impl<const N: usize> AdversarialEvaluator<N> {
|
|||
impl<const N: usize> Evaluator<N> for AdversarialEvaluator<N> {
|
||||
fn evaluate(&self, word: Word<N>) -> Matches<N> {
|
||||
let best_secrets = self.best_secrets(word);
|
||||
return guess(&word, best_secrets.first().unwrap());
|
||||
let mut secret_with_most_nowheres: Option<Word<N>> = None;
|
||||
let mut most_nowheres = None;
|
||||
for secret in best_secrets {
|
||||
let matches = guess(&word, &secret);
|
||||
let nowheres = matches.iter().filter(|&m| m == &LetterMatch::NOWHERE).count();
|
||||
if most_nowheres.is_none() || nowheres > most_nowheres.unwrap() {
|
||||
most_nowheres = Some(nowheres);
|
||||
secret_with_most_nowheres = Some(secret);
|
||||
}
|
||||
}
|
||||
return guess(&word, &secret_with_most_nowheres.unwrap());
|
||||
}
|
||||
|
||||
fn push(&mut self, result: GuessResult<N>) {
|
||||
|
|
Loading…
Reference in a new issue