Wordle Game with Bot
Wordle Buster is a quick and concise attempt at the Wordle giant from the New York Times.
Technologies Used
Backend Game Server (/game
):
FastAPI – Modern Python web framework providing RESTful API endpoints
Uvicorn – ASGI server for running the FastAPI application
Pydantic – Data validation and serialization for API models
Python Standard Library – UUID generation, datetime handling, file I/O
AI Player Client (/player
):
Python with object-oriented design patterns
Requests – HTTP client for API communication
Joblib – Parallel processing for running multiple bot instances
Enum-based State Management – Finite state machine for bot lifecycle
System Components & Connections
1. Game Server (Port 9009)
Hosts a Wordle game API with endpoints:
POST /api/v1/wordle/start
– Creates new games with unique UUIDsPOST /api/v1/wordle/play/{game_id}
– Processes guesses and returns feedback
Maintains in-memory game state using dictionaries
Uses local word dictionary (
words.txt
) for target word selectionValidates guesses and provides color-coded feedback (correct/wrong_position/incorrect)
2. AI Player System
BotLifecycle Class: Abstract base managing bot state transitions (initialized → waiting → active → completed)
WordleBot Class: Implements intelligent word selection strategy:
Starts with “heats” as opening word
Filters word list based on previous guess results
Uses constraint satisfaction to eliminate impossible words
Parallel Execution: Runs 9 concurrent bot instances using joblib for performance testing
Data Flow
Game Initialization: Bot requests new game from server, receives game_id
Guess-Response Loop:
Bot selects word using filtering algorithm
Sends HTTP POST with guess to game server
Server validates guess, updates game state, returns result
Bot processes feedback to refine word candidates
Game Completion: Bot tracks statistics (win rate, average attempts) across multiple games
Performance Features
Concurrent Processing: Multiple bot instances run simultaneously
Memory Efficiency: Server uses in-memory storage for fast game state access
Smart Filtering: Bot eliminates impossible words after each guess, reducing search space
Statistical Tracking: System monitors win rates and performance metrics across thousands of games
The system effectively demonstrates an AI solving Wordle through constraint satisfaction and statistical analysis, with a clean separation between the game engine and the solving algorithm.