-
Notifications
You must be signed in to change notification settings - Fork 0
/
stupid.py
70 lines (63 loc) · 1.69 KB
/
stupid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Random collection of stupid rules
import random
import requests # Used to get wordle data from nytimes
from datetime import datetime # Used to get the date for the wordle answer
# Generate random persistent values
phonetic_morse = [
".- .-.. .--. .... .-",
"-... . - .-",
"--. .- -- -- .-",
"-.-. .... .- .-. .-.. .. .",
"-.. . .-.. - .-",
". -.-. .... ---",
"..-. --- -..- - .-. --- -",
"--. --- .-.. ..-.",
".... --- - . .-..",
".. -. -.. .. .-",
".--- ..- .-.. .. . - -",
"-.- .. .-.. ---",
".-.. .. -- .-",
"-- .. -.- .",
"-. --- ...- . -- -... . .-.",
"--- ... -.-. .- .-.",
".--. .- .--. .-",
"--.- ..- . -... . -.-.",
".-. --- -- . ---",
"... .. . .-. .-. .-",
"- .- -. --. ---",
"..- -. .. ..-. --- .-. --",
"...- .. -.-. - --- .-.",
".-- .... .. ... -.- . -.--",
"-..- .-. .- -.--",
"-.-- .- -. -.- . .",
"--.. ..- .-.. ..-",
]
# Get wordle answer from https://www.nytimes.com/svc/wordle/v2/YYYY-MM-DD.json
print("Fetching wordle data...")
current_date = datetime.now().date()
wordle_ans = requests.get(
"https://www.nytimes.com/svc/wordle/v2/"
+ current_date.strftime("%Y-%m-%d")
+ ".json"
).json()["solution"]
# Check for a letter from the phonetic alphabet in morse code
def phonetic(i, password):
# Check each character
for s in phonetic_morse:
if s in password:
return True
# Did not pass
print(
"Rule "
+ str(i)
+ ": Password must contain a letter from the phonetic alphabet in morse code."
)
return False
# Check wordle answer
def wordle(i, password):
# Test already cached answer against password
if wordle_ans in password.lower():
return True
# Did not pass
print("Rule " + str(i) + ": Password must contain todays wordle answer.")
return False