Last active
July 20, 2025 12:05
-
-
Save dclstn/b2e7e9c93c426daa75a7349889ee7526 to your computer and use it in GitHub Desktop.
A script to paint a 5x5 grid on Worlde
This file contains hidden or 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
| import argparse | |
| parser = argparse.ArgumentParser(description="Wordle Painter") | |
| parser.add_argument("--word", type=str, help="Today's wordle word") | |
| # 0 = No match | |
| # 1 = Match in the word but not in the right position | |
| # 2 = Match in the word and in the right position | |
| map = [ | |
| [1, 0, 1, 0, 1], | |
| [1, 0, 1, 0, 0], | |
| [1, 1, 1, 0, 1], | |
| [1, 0, 1, 0, 1], | |
| [1, 0, 1, 0, 1], | |
| [2, 2, 2, 2, 2], | |
| ] | |
| def main(): | |
| args = parser.parse_args() | |
| answer = args.word.lower() | |
| if not answer or len(answer) != 5: | |
| print("Please provide a word using --word argument.") | |
| return | |
| with open("words.txt", "r") as file: | |
| words = [w.lower() for w in file.read().splitlines() if len(w) == 5] | |
| possible_words = {0: [], 1: [], 2: [], 3: [], 4: [], 5: []} | |
| for a, row in enumerate(map): | |
| for word in words: | |
| possible = True | |
| used = [] | |
| for i, value in enumerate(row): | |
| word_char = word[i] | |
| answer_char = answer[i] | |
| if value == 0 and word_char in answer: | |
| possible = False | |
| if value == 1 and (word_char not in answer or word_char == answer_char or word_char in used): | |
| possible = False | |
| if value == 2 and word_char != answer_char: | |
| possible = False | |
| used.append(word_char) | |
| if possible: | |
| possible_words[a].append(word) | |
| break | |
| print(possible_words) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment