Add a slight bias towards words that are also valid guesses

This commit is contained in:
Kelvin Ly 2023-05-13 08:31:17 -04:00
parent 89bce94a76
commit cae333e3a1
3 changed files with 8 additions and 1 deletions

View File

@ -292,6 +292,6 @@ var chosen_words = [];
<p>2. Use "Find best" to choose a word for you or enter in your own choice of word, and press Submit word. Submit this word in Wordle as well</p>
<p>3. Click on the letters of the word to match the results of what was matching according to Wordle. Hit confirm when it matches the colors of the word in Wordle. This will cause the solver to eliminate words that are no longer possible. If there was an error in the color pattern you can hit Back to remove the last confirmed word, and reenter it. </p>
<p>4. Optimally win Wordle. </p>
<p>There's a slight discrepancy between this and the original JavaScript version; the original Javascript version includes one extra word, which is probably just an empty line or something like that
<p>There's a slight discrepancy between this and the original JavaScript version; the original Javascript version includes one extra word, which is probably just an empty line or something like that. This leads to an extra word count in a lot of situations
</body>
</html>

Binary file not shown.

View File

@ -165,6 +165,13 @@ impl Solver {
}
let mut cur_best = -1;
let mut cur_entropy = 0f32;
for i in 0..self.valid_words.len() {
let entropy = self.calc_entropy(self.valid_words[i] as usize) + 1e-9;
if entropy > cur_entropy {
cur_entropy = entropy;
cur_best = self.valid_words[i] as isize;
}
}
for i in 0..self.idxs.len() {
let entropy = self.calc_entropy(i);
if entropy > cur_entropy {