Skip to content

Instantly share code, notes, and snippets.

@bagf
Created June 25, 2026 12:05
Show Gist options
  • Select an option

  • Save bagf/c161bf480a3ba2e2366b5950c5790dff to your computer and use it in GitHub Desktop.

Select an option

Save bagf/c161bf480a3ba2e2366b5950c5790dff to your computer and use it in GitHub Desktop.
# Resolves possible 5 letter wordle guesses, sssh its a secret cheat script
import sys
sys.argv.pop(0)
if len(sys.argv) == 0 or 'help' in sys.argv[0]:
print("usage: first 5 args is the known word _ for unknown prefix - for letters that are known to be in the word but not at that position, remaining args are known excluded letters")
print("example: ./wordle_cheat.py -t _ i -n _ m a g o h k")
print(" excludes m a g o h k letters and makes sure t cannot be the first, n cannot be the 4th and i must be the 3rd letter")
exit(0)
with open('/usr/share/dict/words', 'r', encoding='utf-8', errors='ignore') as f:
for word in f:
word = word.strip().lower()
if len(word) != 5: continue
for i, argv in enumerate(sys.argv):
if i < 5 and argv != '_' and argv[0] != '-' and argv.lower() != word[i]: break
if i < 5 and argv[0] == '-' and (argv.lower()[1] == word[i] or argv.lower()[1] not in word): break
if i >= 5 and argv.lower() in word: break
else:
print(word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment