Skip to content

Commit b509def

Browse files
committed
Bug fix
1 parent bcb96b2 commit b509def

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

wordle_solver/wordle_solver.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def on_release(key):
3333

3434
# Get the status of the letters in the wordle
3535
def get_row_results(game_row):
36-
tiles = game_row.find_elements(By.CLASS_NAME, "Tile-module_tile__3ayIZ")
36+
tiles = game_row.find_elements(By.CLASS_NAME, "Tile-module_tile__UWEHN")
3737
row_results = []
3838
res_to_int = {
3939
"correct": 1,
@@ -102,6 +102,8 @@ def solving_algorithm(res, finder):
102102
print(f"Letter {word[letter]} is correct")
103103
finder.word[letter] = word[letter]
104104
print(finder.word)
105+
if word[letter] in finder.absent_letters:
106+
finder.absent_letters.remove(word[letter])
105107

106108
elif res[letter] == 0: # Case when the status of the letter is "present" (present but at the wrong position)
107109
print(f"Letter {word[letter]} is present")
@@ -114,10 +116,10 @@ def solving_algorithm(res, finder):
114116
print(f"Letter {word[letter]} is absent")
115117
if word[letter] not in finder.present_letters:
116118
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))
119+
120+
# We keep all the words that don't match the pattern of the word entered
121+
finder.possible_words = list(
122+
filter(lambda x_word: not check_match(word[letter], x_word[letter]), finder.possible_words))
121123

122124
print("\n")
123125
print("Updating list of possible words ...")
@@ -139,10 +141,10 @@ def solving_algorithm(res, finder):
139141

140142
print("List of possible words updated !\n")
141143

142-
print("letter not in the right position : ", finder.present_letters)
143-
print("Letters with absent status", finder.absent_letters)
144-
print("list of words : ", finder.possible_words)
145-
print("length of list", len(finder.possible_words))
144+
print("Letter not in the right position : ", finder.present_letters)
145+
print("Letters with absent status : ", finder.absent_letters)
146+
print("List of words : ", finder.possible_words)
147+
print("Length of list", len(finder.possible_words))
146148

147149

148150
def main():
@@ -165,7 +167,7 @@ def main():
165167
time.sleep(1)
166168

167169
# Get the game rows
168-
game_rows = browser.find_elements(By.CLASS_NAME, 'Row-module_row__dEHfN')
170+
game_rows = browser.find_elements(By.CLASS_NAME, 'Row-module_row__pwpBq')
169171

170172
# Enter words until the game is over or the wordle is solved
171173
for i in range(guesses_left, 0, -1):

0 commit comments

Comments
 (0)