Skip to content

jbordoe/wordle-bot

Repository files navigation

Wordle Bot

A bot that plays Wordle.

CI Status Code Coverage License: MIT

Designed to play Wordle and its variants, featuring multiple player types including human, statistical bot, and LLM-powered AI, with both command-line and in-browser play.

Features

  • Multiple Game Modes: Supports the classic Wordle and the more challenging Absurdle.
  • Player Types:
    • Human Player: Interactive command-line interface for manual play.
    • Statistical Bot: An AI player that uses letter frequency analysis and statistical methods to make optimal guesses.
    • LLM Player: Uses an LLM to generate intelligent guesses.
    • Neural-Net Player
  • In-Browser Automation: Can simulate human interaction in a web browser.
  • Headless Browser Support: Run browser-based games in the background.
  • Performance Evaluation: Includes scripts to run extensive game simulations and generate performance statistics and visualization for analysis.

Getting Started

This project uses pipenv for dependency management.

1. Setup

Install Python packages:

pipenv install

Next, ensure that geckodriver is installed and available in your system's PATH.

Finally, initialize virtual Python env:

pipenv shell

2. Running the Bot

main.py is the entry point for playing Wordle.

In-Browser Play (Bot/LLM)

Have the bot play a game of Wordle in a browser:

python main.py --player bot --variant wordle

Play Wordle in a browser, with SALET and UNFIT as the first guesses:

python main.py --player bot --variant wordle --guesses SALET,UNFIT

Have the bot play a game of Absurdle in a headless browser:

python main.py --player bot --variant absurdle --headless

Have the LLM play a game of Wordle in a browser:

python main.py --player llm --variant wordle

Command-Line Game (Human)

To play a game of Wordle on the command line yourself:

python main.py --player human

Use --help for more information on all available options.

License

This project is licensed under the MIT License - see the LICENSE file for details.

3. Running Tests

To run the test suite:

python -m unittest discover test

Code Coverage

This project uses coverage.py to measure test coverage.

Run the tests and collect coverage data:

pipenv run coverage run -m unittest discover test

View the report in the terminal:

pipenv run coverage report -m

Generate a detailed HTML report:

pipenv run coverage html

The report will be saved in htmlcov/index.html.