fix pattern bug where yellow takes precedence
This commit is contained in:
+4
-6
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user