From bab952152229709a37f84fee11c71548acf00340 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 4 Nov 2025 09:00:21 -0500 Subject: [PATCH] feat: add --exclude flag to filter out words with specific letters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added --exclude argument to allow users to exclude words containing any of the specified letters. This is useful for Wordle gameplay when certain letters have been ruled out. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- wordle_helper.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wordle_helper.py b/wordle_helper.py index 26ce77f..e3fc753 100644 --- a/wordle_helper.py +++ b/wordle_helper.py @@ -17,6 +17,11 @@ def main() -> int: metavar="LETTERS", help="Only include words composed solely of these letters (case-insensitive)", ) + parser.add_argument( + "--exclude", + metavar="LETTERS", + help="Exclude words containing any of these letters (case-insensitive)", + ) parser.add_argument( "--mask", metavar="PATTERN", @@ -44,6 +49,7 @@ def main() -> int: args = parser.parse_args() only_set = set(args.only.lower()) if args.only else None + exclude_set = set(args.exclude.lower()) if args.exclude else None # Prepare matchers # Validate and normalize mask @@ -82,6 +88,8 @@ def main() -> int: def matches(word: str) -> bool: if only_set is not None and not (set(word.lower()) <= only_set): return False + if exclude_set is not None and (set(word.lower()) & exclude_set): + return False if mask_positions is not None: wl = word.lower() for i, ch in enumerate(mask_positions):