Refactor dictionary logic into it's own file.
This commit is contained in:
1 parent
b3b9601abc
commit
497c48f853
2 files changed
+90
-85
No files matched your search
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
WORDLE_LENGTH = 5
|
||||
|
||||
|
||||
_wordle_dictionary = set()
|
||||
|
||||
|
||||
_invalid_words = set(
|
||||
[
|
||||
"amala",
|
||||
"arara",
|
||||
"araru",
|
||||
"araua",
|
||||
"arawa",
|
||||
"balak",
|
||||
"batak",
|
||||
"bayal",
|
||||
"beala",
|
||||
"beata",
|
||||
"beele",
|
||||
"boily",
|
||||
"bolty",
|
||||
"bruke",
|
||||
"carlo",
|
||||
"caroa",
|
||||
"carot",
|
||||
"carum",
|
||||
"divet",
|
||||
"doray",
|
||||
"erept",
|
||||
"fikie",
|
||||
"genae",
|
||||
"ghole",
|
||||
"gotra",
|
||||
"hirse",
|
||||
"hyrse",
|
||||
"katat",
|
||||
"korah",
|
||||
"macco",
|
||||
"mitra",
|
||||
"muang",
|
||||
"nurry",
|
||||
"odell",
|
||||
"odell",
|
||||
"petro",
|
||||
"pindy",
|
||||
"quito",
|
||||
"retan",
|
||||
"roter",
|
||||
"sisel",
|
||||
"skeel",
|
||||
"staia",
|
||||
"stail",
|
||||
"sussy",
|
||||
"tebet",
|
||||
"telae",
|
||||
"theet",
|
||||
"undig",
|
||||
"uninn",
|
||||
"unkin",
|
||||
"vedet",
|
||||
"whalm",
|
||||
"whaly",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def words():
|
||||
if not _wordle_dictionary:
|
||||
with open("words_alpha.txt") as word_file:
|
||||
all_words = word_file.read().split()
|
||||
_wordle_dictionary.update(
|
||||
filter(
|
||||
lambda w: len(w) == WORDLE_LENGTH and w not in _invalid_words, all_words
|
||||
)
|
||||
)
|
||||
|
||||
return _wordle_dictionary
|
||||
Reference in new issue
Block a user