-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordle.py
executable file
·45 lines (34 loc) · 894 Bytes
/
wordle.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
#!/usr/bin/python3
import argparse
from words import WORDS
parser = argparse.ArgumentParser(
description="""Wordle helper. Enter chars to include and exclude.
example" `python ./wordle.py bort chile`"""
)
parser.add_argument(
"include",
type=str,
help="chars to include",
)
parser.add_argument(
"exclude",
type=str,
help="chars to exclude",
)
def exclude_chars(letters, words):
return filter(lambda x: all(letter not in x for letter in letters), words)
def include_chars(letters, words):
return filter(lambda x: all(letter in x for letter in letters), words)
if __name__ == "__main__":
args = parser.parse_args()
print(
list(
include_chars(
args.include,
exclude_chars(
args.exclude,
WORDS,
),
),
),
)