-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordle.py
More file actions
56 lines (36 loc) · 1.12 KB
/
wordle.py
File metadata and controls
56 lines (36 loc) · 1.12 KB
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
# import matplotlib.pyplot as plt
from game import WordleGame, run_game
import client as cl
WORD_FILE = "sgb-words.txt"
print(f"Loading dictionary from {WORD_FILE}")
dictionary = []
with open(WORD_FILE, 'r') as fin:
for line in fin:
# print(f" -> {line.strip()}")
word = line.strip().lower()
if len(word) != 5:
continue
dictionary.append(word)
print(f"Using {len(dictionary)} words")
# -------------------------------------------------------------------------------------------------
wins = 0
losses = 0
guesses = []
for word in dictionary[:1000]:
# Run game
game = WordleGame(word, max_guesses=6)
# client = cl.WordleInteractive()
# client = cl.RandomDictionarySearchBot(dictionary)
# client = cl.LetterPositionDictSearchBot(dictionary)
client = cl.BigramScoringDictSearchBot(dictionary)
win = run_game(game, client)
# Accounting
if win:
wins += 1
else:
losses += 1
guesses.append(game.guess_count)
print(f"WINS: {wins} / {wins+losses}")
# plt.hist(guesses)
# plt.show()
# import code; code.interact(local=locals())