Skip to content

Commit bcb96b2

Browse files
committed
Algorithm optimisation
1 parent 70d535e commit bcb96b2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wordle_solver/wordle_solver.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ def solving_algorithm(res, finder):
114114
print(f"Letter {word[letter]} is absent")
115115
if word[letter] not in finder.present_letters:
116116
finder.absent_letters.add(word[letter])
117+
else:
118+
# We keep all the words that don't match the pattern of the word entered
119+
finder.possible_words = list(
120+
filter(lambda x_word: not check_match(word[letter], x_word[letter]), finder.possible_words))
117121

118122
print("\n")
119123
print("Updating list of possible words ...")

0 commit comments

Comments
 (0)