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 {
|
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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user