NYT Spelling Bee Words Generator
My friends Pam, Derek and Kate showed me the game Wordle. Recently, Pam mentioned that there are other games at the New York Times, I found Spelling Bee (https://www.nytimes.com/puzzles/spelling-bee). In Spelling Bee, your goal is to make as many words as you can, you are given 7 characters, the central character must be used, only the seven characters may be used, the characters may be repeated, the words must be at least four characters long, longer words are worth more points than shorter words. I decided to create a quick python script to get the words and sorts by longest words first. Today's puzzle has "P" as the central letter, the 7 characters including the central character were "DEHIANP."
#Kevin Lease new york times spelling bee 2023
import string
keepwords = []
keepwords_by_length = []
wordchars = []
central_letter = "p"
allcharactersstring = "dehianp"
allcharacters = []
for letter in allcharactersstring:
allcharacters.append(letter)
def test_word_for_no_bad_characters(test_word):
flag = 1
for letter in test_word:
if letter not in allcharacters:
flag = 0
return(flag)
with open("words_alpha.txt") as file:
allwords = file.read().splitlines()
for i in allwords:
if len(i) > 3: #words have to be at least four characters
if central_letter in i: #words have to contain a character
if (test_word_for_no_bad_characters(i)):
keepwords.append(i)
keepwords_by_length = sorted(keepwords, key=len, reverse=True)
for i in keepwords_by_length:
print(i)
Output:
pinnipedian
adiphenine
aphidiinae
deadpanned
pinnipedia
anapanapa
aphididae
diaphanie
panheaded
pinheaded
apennine
aphidian
appended
daphnean
deepened
depended
diaphane
diphenan
ephippia
happened
hippidae
paninean
pinnidae
pinniped
anaphia
anapnea
apadana
aphidid
daphnad
daphnia
daphnid
daphnin
deadpan
diphead
epeidia
epinine
headpin
hiphape
hippian
napaean
nepidae
ninepin
paideia
pandani
pandean
pandied
panhead
pannade
panpipe
paphian
pappain
penhead
pennied
pennine
phenene
phenine
phidian
pinhead
pipidae
adapid
anaphe
anepia
apidae
apinae
append
daphne
daphni
dapped
deepen
depend
dipped
epidia
happed
happen
heaped
henpen
heppen
hipped
hippen
hippia
hippie
ipidae
nanpie
napaea
napead
napped
nappie
neaped
nipped
padded
padina
paepae
pained
panada
panade
pandan
panini
panned
papain
papane
pappea
peahen
pediad
peened
peeped
peined
penaea
pended
peneid
penide
pennae
penned
pennia
pepped
peppin
phenin
phippe
piepan
pinene
pinnae
pinned
pipped
pippen
pippin
adapa
adeep
aheap
apaid
aphid
apian
I truncated the list here.
Similar to the wordle solver I created previously, there are some words in the list that are not included in the dictionary of words that spelling bee uses, but hopefully this will help someone out there in the world if they get stuck. The central letter and allcharacters variables need to be adjusted for each daily puzzle.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Comments
Post a Comment