Skip to main content

Wordle Utils

Helper functions, word lists, and analysis tools for Wordle and other Wordle variants.

Installation

pip install wordle-utils

Basic Usage

To run a bot that solves wordle for you, just run the following from your terminal after installing the package:

solve_wordle

The bot will output guesses, input what the "result" of those guesses is. _ is a miss/blank, ! is a correct/green, and ? is a wrong spot/yellow letter.

Advanced Usage

This library can be used for more than just solving wordle automatically.

Analysis

To see how many words were possible after a series of guesses use the what_do_i_know function. This takes the actual answer as well as some guesses that were made and returns the possible words after those guesses. This can be useful after completing the Wordle puzzle to see how well you narrowed down the possible word list.

In this example, the actual answer word was ROBOT. The two guesses made were LATER and TROUT. You can see that after these two guesses the only possible words remaining were ROBOT and WORST.

from wordle.analysis import what_do_i_know

what_do_i_know('robot', 'later', 'trout')
# ['robot', 'worst']

Library Functions

This library has some helper functions you can use in your own scripts. These will work for most Wordle variants.

Result

This library includes a Result enum (wordle.core.result.Result) for possible results of a guess. A result can be a miss, wrong spot, or correct. In most functions you can replace the enum with the shorthand string version of a result

  • Result.correct / '!' - the letter appears in this exact spot in the answer
  • Result.wrong_spot / '?' - the letter appears somewhere else in the answer
  • Result.miss / '_' - the letter does not appear in the word

There is some interesting behavior when guesses or answers contain duplicate letters. The test cases should give you a better idea of these. The behavior is meant to mimic the behavior of the actual Wordle game.

get_result

Given a guess and a known answer, return the "result" of the guess. This will be an array of Result objects.

For example, if the answer was ROBOT and the guess was TROUT:

from wordle.core.gameplay import get_result

get_result('trout', 'robot')
# [Result.miss, Result.wrong_spot, Result.wrong_spot, Result.miss, Result.correct]

filter_word_list

Given a starting list of words, return a new filtered down word list based on a guess and its result. You can use this function to whiddle down a word list as more guesses and results are learned.

For example, assume the remaining words were CLAIM, EMAIL, IMAGE, and SIGMA. The player guessed STAIN and got a result of __!!_.

from wordle.core.gameplay import filter_word_list

words = ['claim', 'email', 'image', 'sigma']
new_words = filter_word_list(words, 'stain', '__!!_')
# ['claim', 'email']

Variants

This library supports Wordle variants as well, since many of the gameplay strategies and functions are the same.

Mathler/Nerdle

These are both math based variants of Wordle where rather than guessing words you are guessing equations or expressions

  • Mathler - the target answer is given to you, find an expression that equals it. Comes in easy and hard variants as well.
  • Nerdle - you provide a full 8-digit equation, expression on one side, an equals sign, and then the result on the other side.

To have the solving bot play either of these games, call their solve methods

# Play Mathler (normal mode) with a target number of 314
from wordle.play.mathler import play_mathler
play_mathler(314)
# Play Nerdle
from wordle.play.mathler import play_nerdle
play_nerdle()

Metadata

Release files for wordle-utils 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wordle-utils 0.3.0
File Size Uploaded Provenance Actions
wordle-utils-0.3.0.tar.gz 4.5 MB Without provenance Details for wordle-utils-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wordle-utils 0.3.0
File Interpreter ABI Platform Actions
wordle_utils-0.3.0-py3-none-any.whl Python 3 none any Details for wordle_utils-0.3.0-py3-none-any.whl

Total release size: 9.0 MB

Release files / wordle-utils-0.3.0.tar.gz

Download URL wordle-utils-0.3.0.tar.gz
Size 4.5 MB
Tags Source
SHA-256 checksum
How to use checksums
6e2cf318f3c1621016d0d6fdd8e7d83953d0127efca389c51709293341f041c4
BLAKE2b-256 checksum
How to use checksums
fbe345bd0655d7216714e718b084007a29d5cc82f3877ccaedfe11596c40f076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / wordle_utils-0.3.0-py3-none-any.whl

Download URL wordle_utils-0.3.0-py3-none-any.whl
Size 4.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0a6a19edb69f1ee87077b875d182872ea3be4e5fc87bb82d1fad4fa2ad51e28f
BLAKE2b-256 checksum
How to use checksums
72c93a87cbe2a31bd7079c335a7f9cba05b1249dccebd41cf8441523a9729368
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Security for wordle-utils 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page