Last active
January 20, 2022 00:59
-
-
Save rickumali/8b84fd65602e9ae57a02646b6f06fa8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wordle - https://www.powerlanguage.co.uk/wordle/ | |
# This little program looks up a suitable word given | |
# state of the puzzle (from 2022-Jan-19) | |
# RAISE | |
# BLIMP | |
# CHICK | |
# SWIPE | |
# UNIFY | |
# ----- | |
# rems_known = "nip" | |
def eliminated_letter_in_word(w: str) -> bool: | |
eliminated_letters = "raseblmchksweufy" | |
for i in eliminated_letters: | |
if i in w: | |
return True | |
return False | |
count = 0 | |
with open('/usr/share/dict/american-english') as f: | |
for w in f: | |
if len(w) == 6: | |
# NOTE: We look for 6 because w will have newline | |
# (Pdb) print(w.split('.')) | |
# ['Abby\n'] | |
w = w.rstrip() | |
count += 1 | |
if not eliminated_letter_in_word(w): | |
if w[2] == 'i': | |
if 'n' in w and 'p' in w: | |
# The word has 'i' in the middle, and contains | |
# the letters 'n' and 'p' | |
print(w) | |
print(f"{count} 5-letter words searched") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment