New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explanation regarding the double call to calculate_entropies() #9
Comments
Wordle keeps track of two lists: (i) a list of possible correct answers and (ii) a much bigger list of valid words that the user can enter. The first call will try to find a good guess from list (i), but in case there are still many options, it might be better to guess a word from list (ii) to have better outcomes for the next round. |
There are indeed two lists:
Lines 11 to 12 in f633495
Here:
Lines 71 to 77 in f633495
Here:
Lines 112 to 113 in f633495
And here, we have Regarding the
Line 107 in f633495
Lines 130 to 132 in f633495
Regarding the Line 97 in f633495
|
I wonder whether what you wanted to do would have been: candidates = all_words
entropies = calculate_entropies(candidates, all_words, pattern_dict, all_patterns)
if max(entropies.values()) < 0.1:
candidates = all_dictionary
entropies = calculate_entropies(candidates, all_words, pattern_dict, all_patterns) instead of: Lines 112 to 117 in f633495
|
Ok yes, you are correct! This logic seems to indeed be switched up & the calculations in the if-block are redundant. I think it should indeed be switched as you suggested, but we could bench the code to be sure the results are the same (or better)? We could iterate over every possible word and calculate how many guesses the bot needs on average. I will merge your PRs later this week. Once again, many thanks for your contributions! |
No problem. I agree it is better to test before merging:
|
I don't understand the double call to
calculate_entropies()
. Could you clarify the reason behind it?Wordle-Bot/wordle.py
Lines 112 to 117 in f633495
Indeed:
all_words
is a subset ofall_dictionary
,entropies
is a dictionary whose keys arecandidates
by design.So the second call to
calculate_entropies()
recomputes entropy values which were already computed by the first call.If the objective is to decrease the number of items fed to
max()
, it could be done by filteringentropies
returned by the first call.Wordle-Bot/wordle.py
Lines 119 to 120 in f633495
The text was updated successfully, but these errors were encountered: