improve remaining guess estimation
This commit is contained in:
+9
-3
@@ -70,6 +70,14 @@ impl Solver {
|
||||
});
|
||||
}
|
||||
|
||||
fn estimate_guesses(&self, expected_information_gained: f64) -> f64 {
|
||||
if self.possible_solutions.len() == 1 {
|
||||
1.0
|
||||
} else {
|
||||
1.0 + self.possible_solutions.equal_likelieness_entropy() - expected_information_gained
|
||||
}
|
||||
}
|
||||
|
||||
pub fn evaluate_word(&self, word: &str) -> WordStats {
|
||||
let solution_probability = self.possible_solutions.word_probability(word);
|
||||
|
||||
@@ -79,9 +87,7 @@ impl Solver {
|
||||
|
||||
let expected_score_after_guess = score * solution_probability
|
||||
+ (1.0 - solution_probability)
|
||||
* (score
|
||||
+ (self.valid_words.equal_likelieness_entropy() - expected_information_gained)
|
||||
.log2());
|
||||
* (score + self.estimate_guesses(expected_information_gained));
|
||||
|
||||
WordStats {
|
||||
word: word.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user