Skip to content

Commit eeff382

Browse files
committed
Fix "dupplicate" key presses
1 parent 310e46b commit eeff382

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

wordle_solver/wordle_solver.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,13 @@ def solving_algorithm(word, res):
110110

111111
for absent in absent_letters:
112112
print(absent)
113-
list_of_words = list(filter(check_letter_in_word(absent, list_of_words), list_of_words))
114-
115-
list_of_words = buffer_list
116-
117-
113+
list_of_words = list(filter(check_letter_in_word(absent), list_of_words))
118114

119115
print("letter not in the right position : ", present_letters)
120116
print("Letters with absent status", absent_letters)
121117
print("solving string :", solving_string)
122118
# print(list_of_words)
123-
print("lenght of list", len(buffer_list))
119+
print("length of list", len(list_of_words))
124120

125121

126122
def main():
@@ -129,17 +125,21 @@ def main():
129125
browser.get("https://www.nytimes.com/games/wordle/index.html")
130126

131127
# Wait for start
132-
with keyboard.Listener(on_release=on_release) as listener:
128+
with keyboard.Listener(on_release=on_release, suppress=True) as listener:
129+
print("Starting")
133130
listener.join()
134-
print("Starting")
131+
132+
# With "suppress=True", duplicate key presses are not sent to the application
133+
# but for some reason I need to add a delay for the first input to be sent.
134+
time.sleep(1)
135135

136136
# Get the game rows
137137
game_rows = browser.find_elements(By.CLASS_NAME, 'Row-module_row__dEHfN')
138138

139139
first_string = "tests"
140140
enter_word(first_string)
141141
res = get_row_results(game_rows[0])
142-
solving_algorithm(first_string, res)
142+
# solving_algorithm(first_string, res)
143143

144144
time.sleep(1)
145145

0 commit comments

Comments
 (0)