A Python bot that screenshots a 6-letter word game, OCRs the tiles, finds every valid word using the system dictionary, then auto-clicks through all of them as fast as possible within 60 seconds.
- macOS
- Python 3.10+
- Tesseract OCR
Install Tesseract:
brew install tesseractInstall Python dependencies:
python3 -m pip install pyautogui pillow pytesseract --break-system-packagespython3 anagrams.pyAfter running, you have 3 seconds to switch to the game window. The bot will take a screenshot, read the tiles, solve all possible words, and begin clicking. It stops automatically after 60 seconds.
To stop early, move your mouse to the top-left corner of the screen.
-
Display scaling - Detects Retina display scale factor by comparing PyAutoGUI's logical screen size to the physical screenshot size. All crop coordinates are adjusted accordingly.
-
OCR - Takes a single screenshot at startup and crops each of the 6 tile regions. Each crop is upscaled 8x, converted to grayscale, contrast-enhanced, sharpened, and binarized to pure black and white before being passed to Tesseract. OCR runs once and is not repeated.
-
Solver - Generates every permutation of every subset (3 to 6 letters) of the detected letters and checks each against the macOS system dictionary at
/usr/share/dict/words. Results are sorted longest-first to maximize score. -
Clicker - Uses PyAutoGUI to click each letter tile in order, then clicks the on-screen Enter button. Hardcoded coordinates match the tile positions on the mirrored iPhone display.
-
Timer - The entire play session is capped at 60 seconds. The bot checks the time before each word and stops cleanly when the limit is reached.
If OCR fails on any tile, the bot saves two images to the project folder and opens them automatically:
debug_screen_<timestamp>.png- Full annotated screenshot with each crop box drawn. Red boxes indicate failed tiles, green indicates success.debug_tiles_<timestamp>.png- Contact sheet showing the raw crop and preprocessed version of each tile side by side, with the detected letter labeled below.
The following constants at the top of anagrams.py can be adjusted:
| Constant | Default | Description |
|---|---|---|
LETTER_COORDS |
see script | Logical (x, y) click coordinates for each tile |
ENTER_COORD |
see script | Logical (x, y) coordinate for the Enter button |
LETTER_DELAY |
0.01s | Delay between each letter click |
ENTER_DELAY |
0.01s | Delay before clicking Enter |
WORD_DELAY |
0.10s | Delay between words |
TILE_RADIUS |
24px | Half-width of each tile crop box in logical pixels |
RUN_DURATION |
60s | How long the bot plays before shutting down |
