0.0
The project is in a healthy, maintained state
Solves Wordle puzzles by ranking next guesses by expected information gain (Shannon entropy of the feedback-pattern distribution). Ships with the real Wordle word lists and a single-line interactive CLI.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.20
~> 13.0
~> 2.0
 Project Readme

wordl-solver

A Ruby gem that solves Wordle puzzles by ranking each candidate guess by expected information gain — the same technique behind strong public Wordle solvers. Ships with the real Wordle answer and allowed-guess lists and a single-line CLI.

How it ranks guesses

For each candidate guess, the solver simulates what feedback every still-possible answer would produce and computes the Shannon entropy of that distribution. A high-entropy guess splits the remaining answer set into many small buckets, telling you the most you can learn in one move. Higher score = better guess.

Install

gem install wordl-solver

Use

wordl-solver

You enter one line per turn: the word you guessed and the color pattern you got. The pattern is 5 characters from g (green), y (yellow), s (grey). b and . are also accepted for grey.

> crane sygss
Turn 2 — 41 possible answers.
  Possible answers:
    poilu  3.92 bits
    plumb  3.71 bits
  High-info guesses:
    pluot  4.21 bits  (not a possible answer)

Commands

  • :undo — remove the last turn.
  • :restart — start over.
  • :quit — exit.
  • :help — print help.

Flags

  • --top N — show the top N suggestions (default 10).

Going deeper

Two long-form docs explain how the gem works and why it's built the way it is. They're written to be readable on their own, not just as developer notes:

  • docs/ALGORITHM.md — the math. Walks through the Wordle scoring rule, the duplicate-letter filter algorithm, and the Shannon-entropy ranking from first principles, with worked examples. Useful if you want to understand why this approach works.
  • docs/DESIGN.md — the software design. Covers value objects, immutability, pure functions, separation of concerns, dependency injection in the CLI, and the test design philosophy. Useful if you want to learn Ruby design patterns from a small worked example.

Development

bundle install
bundle exec rake test

To regenerate the precomputed opening scores (only needed if word lists change):

bundle exec rake compute_opening_scores

License

MIT. See LICENSE.txt.