add headless mode
This commit is contained in:
parent
a85575c1ba
commit
43d8eebacb
1 changed files with 9 additions and 3 deletions
12
main.py
12
main.py
|
|
@ -1,4 +1,5 @@
|
|||
import numpy as np
|
||||
import sys
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver import ActionChains, Keys
|
||||
from selenium.webdriver.common.by import By
|
||||
|
|
@ -46,7 +47,7 @@ def get_deletions(words, correct_letters: List[str], misplaced_letters: List[str
|
|||
return True
|
||||
if w[i] == misplaced_letters[i] and misplaced_letters[i] != '':
|
||||
return True
|
||||
if incorrect_letters[i] in w and incorrect_letters[i] != '':
|
||||
if incorrect_letters[i] in w and incorrect_letters[i] != '' and incorrect_letters[i] not in (correct_letters + misplaced_letters):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
@ -134,6 +135,11 @@ def main(mode):
|
|||
ranked_words = filter_words(ranked_words, correct_letters, misplaced_letters, incorrect_letters)
|
||||
guess = get_guess(turn, ranked_words, correct_letters, misplaced_letters, incorrect_letters)
|
||||
|
||||
if mode == -1:
|
||||
print('Suggested:', guess)
|
||||
guess = input('Custom guess:')
|
||||
|
||||
|
||||
if mode == 1 and guess is None:
|
||||
driver.find_element(By.XPATH, '/html/body/div[1]/div/section[1]/div/div[1]/div/div[1]/div/div/header/div[2]/button[2]').click()
|
||||
text = driver.find_element(By.XPATH, '/html/body/div[1]/div/section[1]/div/div[1]/div/div[1]/div/div/div[6]/div[2]/div/div[2]/span').text
|
||||
|
|
@ -146,7 +152,7 @@ def main(mode):
|
|||
misplaced_letters = [''] * 5
|
||||
incorrect_letters = [''] * 5
|
||||
|
||||
if mode == 0:
|
||||
if mode <= 0:
|
||||
print("Guess:", guess)
|
||||
c_indicies = [int(i) for i in str(input("Indicies of green letters: ")).strip().split()]
|
||||
m_indicies = [int(i) for i in str(input("Indicies of yellow letters: ")).strip().split()]
|
||||
|
|
@ -198,4 +204,4 @@ def main(mode):
|
|||
WebDriverWait(driver, 1000000).until(EC.element_to_be_clickable((By.XPATH,
|
||||
'/html/body/div[1]/div/section[1]/div/div[1]/div/div[1]/div/div/div[6]/div[2]/div/div[3]/button'))).click()
|
||||
|
||||
main(1)
|
||||
main(int(sys.argv[1]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue