Skip to main content

Finds the optimal solution for a game of Wordle

Project description

WordlePro

PyPI CI Coverage Python uv mypy License: MIT GitHub repo

An entropy-based Wordle solver that computes optimal guesses using information theory. Given the remaining possible answers, WordlePro selects whichever guess maximizes expected information gain — minimizing the number of guesses needed to solve the puzzle. Supports standard Wordle and multi-board variants like Quordle.

Features

  • Optimal guessing — picks the guess with maximum expected entropy across all remaining candidates
  • Multi-board support — solve Quordle and other N-board variants with --boards N
  • Pattern matrix cache — precomputes the full guess × answer clue table once and caches it to disk; subsequent runs are instant
  • Interactive solver — guides you through a live game step by step
  • Benchmark mode — runs the solver against every answer word and reports guess-count statistics

Installation

Requires uv.

git clone https://github.com/nhaberla/WordlePro.git
cd WordlePro
uv sync

Usage

Interactive solver

uv run wordlepro solve

WordlePro suggests the best guess each turn. Enter the word you played, then enter the result as a string of digits — 0 (grey), 1 (yellow), 2 (green) — for each board.

Example for a single board:

Suggested guess: CRANE  (5.23 bits)
Enter your guess: crane
Enter results (b1): 01200

Multi-board (e.g. Quordle)

uv run wordlepro solve --boards 4

Results are entered space-separated, one per unsolved board:

Enter results (b1 b2 b3 b4): 00000 01100 22222 00120

Benchmark

uv run wordlepro benchmark

Runs the solver against every answer word and prints a distribution table. Use --json for machine-readable output.

uv run wordlepro benchmark --boards 4 --json

Options

Flag Default Description
--boards N 1 Number of simultaneous boards
--max-guesses N 6 Maximum guesses allowed
--answers-file PATH bundled Override the answer word list
--guesses-file PATH bundled Override the allowed guess list

How it works

  1. Pattern matrix — for every (guess, answer) pair, encodes the Wordle clue as a base-3 integer (0 = grey, 1 = yellow, 2 = green). This matrix is computed once and cached as a .npy file via platformdirs.
  2. Entropy calculation — for each candidate guess, computes the Shannon entropy of the clue distribution across remaining possible answers. Higher entropy → more information gained → fewer guesses expected.
  3. Guess selection — picks the guess with the highest expected entropy. On multi-board games, entropies are summed across boards.
  4. Filtering — after each guess, eliminates answers that are inconsistent with the observed clue pattern.

Development

uv run pytest              # run tests
uv run mypy --strict src/  # type checking

Author

Noah Haberlandnoah17haberland@gmail.com · github.com/nhaberla

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wordlepro-0.2.0.tar.gz (103.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wordlepro-0.2.0-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file wordlepro-0.2.0.tar.gz.

File metadata

  • Download URL: wordlepro-0.2.0.tar.gz
  • Upload date:
  • Size: 103.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wordlepro-0.2.0.tar.gz
Algorithm Hash digest
SHA256 aaecfac47cddf0a3ade007e9705a30dd9df5c2f4616cc2d51296f713a0b4d99a
MD5 53a0efee1c5e291cc2f4d43131470da3
BLAKE2b-256 3686f6bef696f51e8829f803bb1ada46be0f0d3c7630502c55bd10f342fb6a43

See more details on using hashes here.

Provenance

The following attestation bundles were made for wordlepro-0.2.0.tar.gz:

Publisher: publish.yml on nhaberla/WordlePro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wordlepro-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: wordlepro-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wordlepro-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99b03013ed86abb8c36c86d8edc4dd2aa1757c7731c65d4f68f20907157793f6
MD5 f623bb7bffb4ab52f8e25e419914dabb
BLAKE2b-256 508206c6fa2aa65933e073bd9f2f2ef98aabb94070e7b427589e2cfa137fd5cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for wordlepro-0.2.0-py3-none-any.whl:

Publisher: publish.yml on nhaberla/WordlePro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page