wordle/lib.py
2022-01-17 12:42:35 +01:00

21 lines
686 B
Python

DEBUG = False
WORD_LENGTH = 5
ROUNDS = 6
INSTRUCTIONS = "Positional letters (green) are CAPITAL, non-positional (yellow) are small, others are blanks e.g. SHe-r"
BLANK = "-"
DICTIONARY = '/usr/share/dict/words'
def cat_words(dictionary=DICTIONARY):
if type(dictionary) is list:
for word in dictionary:
yield word
else:
with open(dictionary) as f:
for word in f.readlines():
# remove end of line
word = word[:-1]
# filter out five letter words
if len(word) == WORD_LENGTH and all([letter.isalpha() and letter.islower() for letter in word]):
yield word