Skip to content

Commit

Permalink
Merge pull request #7 from woctezuma/fix-function-argument
Browse files Browse the repository at this point in the history
Fix bug: missing function argument
  • Loading branch information
GillesVandewiele committed Jul 23, 2022
2 parents 0f26591 + ccd0029 commit f633495
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wordle.py
Expand Up @@ -53,7 +53,7 @@ def generate_pattern_dict(dictionary):
return dict(pattern_dict)


def calculate_entropies(words, possible_words, pattern_dict):
def calculate_entropies(words, possible_words, pattern_dict, all_patterns):
"""Calculate the entropy for every word in `words`, taking into account
the remaining `possible_words`"""
entropies = {}
Expand Down Expand Up @@ -110,11 +110,11 @@ def main():
for n_round in range(init_round, N_GUESSES):

candidates = all_dictionary
entropies = calculate_entropies(candidates, all_words, pattern_dict)
entropies = calculate_entropies(candidates, all_words, pattern_dict, all_patterns)

if max(entropies.values()) < 0.1:
candidates = all_words
entropies = calculate_entropies(candidates, all_words, pattern_dict)
entropies = calculate_entropies(candidates, all_words, pattern_dict, all_patterns)

# Guess the candiate with highest entropy
guess_word = max(entropies.items(), key=lambda x: x[1])[0]
Expand Down

0 comments on commit f633495

Please sign in to comment.