improve remaining guess estimation

This commit is contained in:
2026-08-18 22:38:47 +02:00
parent 31092eddc4
commit 05c0f4e37c
+9 -3
View File
@@ -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 { pub fn evaluate_word(&self, word: &str) -> WordStats {
let solution_probability = self.possible_solutions.word_probability(word); let solution_probability = self.possible_solutions.word_probability(word);
@@ -79,9 +87,7 @@ impl Solver {
let expected_score_after_guess = score * solution_probability let expected_score_after_guess = score * solution_probability
+ (1.0 - solution_probability) + (1.0 - solution_probability)
* (score * (score + self.estimate_guesses(expected_information_gained));
+ (self.valid_words.equal_likelieness_entropy() - expected_information_gained)
.log2());
WordStats { WordStats {
word: word.to_string(), word: word.to_string(),