fix pattern bug where yellow takes precedence

This commit is contained in:
2026-08-18 21:18:28 +02:00
parent 416ab6beba
commit 715bce656d
5 changed files with 69 additions and 33 deletions
+4 -6
View File
@@ -80,10 +80,8 @@ 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()
+ 1.0));
+ (self.valid_words.equal_likelieness_entropy() - expected_information_gained)
.log2());
WordStats {
word: word.to_string(),
@@ -110,7 +108,7 @@ impl Solver {
self.best_words.clone()
}
pub fn best_word_format(&self) -> String {
pub fn best_word_format(&self, n: usize) -> String {
let mut table = Table::new("#{:<} {:>} | {:<} {:<} {:<}");
table.add_row(
@@ -121,7 +119,7 @@ impl Solver {
.with_cell("E[I]")
.with_cell("E[score]"),
);
for (i, ws) in self.best_words.iter().take(10).enumerate() {
for (i, ws) in self.best_words.iter().take(n).enumerate() {
table.add_row(
Row::new()
.with_cell(i + 1)