-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordle_solver.py
executable file
·36 lines (36 loc) · 1.28 KB
/
wordle_solver.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
#!/usr/bin/env python3
# Geoff 2021-01-23
#
def main():
import argparse, solver
ap = argparse.ArgumentParser(description="""
Help guess Wordle puzzles. Supply optional strings of letters, either
grey, yellow, or green.""")
ap.add_argument("-v", "--verbosity", help="increase output verbosity",
default=0, action="count")
ap.add_argument("-b", "--grey", help="grey letter string", type=str)
ap.add_argument("-y", "--yellow", help="yellow letter pattern", type=str,
action="append") # allow several -y "pattern"
ap.add_argument("-g", "--green", help="green letter pattern", type=str)
ap.add_argument("-f", "--guessfile", default="guesses.txt", type=str,
help="file containings guesses")
args = ap.parse_args()
if args.verbosity:
print("verbosity level", args.verbosity)
if args.grey:
print("grey:", len(args.grey), args.grey)
if args.yellow:
print("yellow:", len(args.yellow), args.yellow)
if args.green:
print("green:", len(args.green), args.green)
if args.guessfile:
print("guessfile:", args.guessfile)
else:
args.guessfile = "guesses.txt"
#
solve = solver.Wordle_Solver(args.verbosity,
args.grey, args.yellow, args.green, args.guessfile)
solve.solve()
#
if __name__ == "__main__":
main()