Command-line clone of Josh Wardle's Wordle, inspired by Paul Battley's Ruby version. Features:
- play against random solutions, or against the once-a-day "official" Wordle solution (with
--today
) - official dictionaries of solutions and valid guesses
- spoiler-free emoji summaries for sharing
Using a combination of Knuth's minimax algorithm for Mastermind and two hardcoded initial guesses, it's possible to win Wordle for 100% of possible solutions. The algorithm is seeded with the "offical" list of valid guesses (not the solutions). This is effectively available to human players as well (as the game rejects invalid words without using up a guess). This repo contained a solver, but it was unnecessarily slow, so I'm rewriting it and will release in due course.
Requires Python 3.6 or later, and a modern terminal app (e.g. Windows Terminal if running Windows)
To get the code:
git clone https://github.com/klipspringr/wordle-cli.git && cd wordle-cli
alternatively, if you don't have git: click Code > Download ZIP
on GitHub, extract the ZIP, open a terminal and cd
to the extracted folder.
To run on Linux or WSL:
./play.py
To run on Windows:
python3 play.py
A terminal with colour and emoji support is required. On Windows and WSL, Windows Terminal is the best choice. PowerShell and the Windows command prompt are only supported if running in Windows Terminal.
Not tested on macOS, but should work — let me know if any problems!
Usage: ./play.py [-h|--help|--today|SOLUTION]
Argument | Behaviour |
---|---|
none | Use a random solution from the official Wordle dictionary |
-h , --help |
Print this help text and quit |
--today |
Use today's official Wordle solution |
SOLUTION |
Use a given SOLUTION (probably only useful for debugging) |
To tweak the terminal colours and other variables, copy config.ini.defaults
to config.ini
and uncomment and edit the relevant lines. Colours are specified using ECMA-48 Select Graphic Rendition codes (cheat sheet).