The most comprehensive, exhaustive, parameterized command-line wordle solver.

Overview

Wordle Solver

The most comprehensive, exhaustive, parameterized command-line wordle (https://www.powerlanguage.co.uk/wordle/) solver. Wordle is a really popular game made viral by it's inscrutable and quirky emoticon-based game description.

The solver boasts a 99.35%+ accuracy on the 8636 valid 5-letter words. Features:

  • Supports 4 modes: play, show (to show a solution for a specific word), solve (to solve a puzzle online) and eval (evaluate the performance)
  • Deterministic
  • Highest accuracy of all solutions evaluated
  • Fully tested
  • Latency ~0.26s per run Current dictionary used is the valid Scrabble dictionary.

Solver’s attempt to solve the Jan 10, 2022 wordle for the word query:

β¬›πŸŸ¨β¬›β¬›πŸŸ¨ AROSE
β¬›πŸŸ©β¬›β¬›β¬› TUMID
β¬›β¬›πŸŸ¨β¬›β¬› GLYPH
🟩🟩🟩🟩🟩 QUERY

Screen Shot 2022-01-12 at 12 26 16 AM

Algorithm

With the settings for non-strict play, using positional

  • Find all candidates that fit the criteria
  • Amongst the valid candidates, compute a distribution of letters at each position
  • Find a word from all valid guesses which optimizes sum(P(letter at pos i)) + 0.5 * sum(P letter not at pos i)
  • Repeat

The 56 failure cases are sakes, mooed, jived, wanes, jocks, minks, wades, jaded, zoner, joker, wived, jakes, mozos, goxes, vills, rover, zooks, cozes, jibes, wakes, hajes, joked, sinhs, zaxes, yaffs, hiker, bases, moved, bises, zills, hided, eaved, vined, surfs, jiber, gibed, dozer, fuzed, mixed, boxed, waxes, waves, vomer, egged, mazed, pests, hived, socks, fazes, vests, jibed, mewed, hazes, sooks, woods, sinks For all these words, there are 2-5 candidate words left at the last guess, and with a random last guess, there is a probability of guessing these too.

Usage

Play it yourself

python main.py -m play

Guess? tares
TARES
β¬›πŸŸ©πŸŸ¨β¬›β¬›
Guess? unlit
UNLIT
⬛⬛⬛⬛⬛
Guess? raver
RAVER
πŸŸ¨πŸŸ©πŸŸ©β¬›πŸŸ©
Guess? favor
FAVOR
🟩🟩🟩🟩🟩
Solved! - favor

Solve for an unknown word

python main.py -m solve

Try the word [TARES]. There are 8636 possible words: ['aahed', 'aalii', 'aargh', 'abaca', 'abaci']...
How did it do (0=⬛, 1=🟨, 2=🟩) e.g. 00000? 00000
Try the word [NOILY]. There are 575 possible words: ['biddy', 'biffy', 'bifid', 'bigly', 'bijou']...
How did it do (0=⬛, 1=🟨, 2=🟩) e.g. 00000? 02002
Try the word [DHOBI]. There are 39 possible words: ['bobby', 'boggy', 'booby', 'boogy', 'boomy']...
How did it do (0=⬛, 1=🟨, 2=🟩) e.g. 00000? 20100
Try the word [DODGY]. There are 3 possible words: ['dodgy', 'doggy', 'dowdy']...
How did it do (0=⬛, 1=🟨, 2=🟩) e.g. 00000? 22122
Try the word [DOGGY]. There are 1 possible words: ['doggy']...
How did it do (0=⬛, 1=🟨, 2=🟩) e.g. 00000? 22222
Solved! = doggy

Show a solution for a specific word

python main.py -m show -w oozed

Word [OOZED]
Choosing [tares]. Total 8636 candidates: ['aahed', 'aalii', 'aargh', 'abaca', 'abaci']...
TARES
β¬›β¬›β¬›πŸŸ©β¬›
Choosing [coled]. Total 288 candidates: ['bedel', 'bedew', 'bevel', 'bezel', 'bided']...
COLED
β¬›πŸŸ©β¬›πŸŸ©πŸŸ©
Choosing [howdy]. Total 31 candidates: ['boded', 'boned', 'booed', 'bowed', 'boxed']...
HOWDY
β¬›πŸŸ©β¬›πŸŸ¨β¬›
Choosing [bipod]. Total 16 candidates: ['boded', 'boned', 'booed', 'boxed', 'domed']...
BIPOD
β¬›β¬›β¬›πŸŸ¨πŸŸ©
Choosing [dozen]. Total 8 candidates: ['domed', 'dozed', 'foxed', 'joked', 'mooed']...
DOZEN
πŸŸ¨πŸŸ©πŸŸ©πŸŸ©β¬›
Choosing [oozed]. Total 1 candidates: ['oozed']...
OOZED
🟩🟩🟩🟩🟩
Solved! - oozed
Woohoo! Solver solved it in 6 guesses!

Evaluate its performance

python main.py -m eval -k 1000

Evaluating on 1000 words
k=10:	Failed: 1	Accuracy:90.00%	Avg Time: 0.258s
k=20:	Failed: 1	Accuracy:95.00%	Avg Time: 0.250s
k=30:	Failed: 1	Accuracy:96.67%	Avg Time: 0.249s
k=40:	Failed: 1	Accuracy:97.50%	Avg Time: 0.244s
k=50:	Failed: 1	Accuracy:98.00%	Avg Time: 0.239s
...
k=970:	Failed: 10	Accuracy:98.97%	Avg Time: 0.236s
k=980:	Failed: 10	Accuracy:98.98%	Avg Time: 0.236s
k=990:	Failed: 10	Accuracy:98.99%	Avg Time: 0.236s
Failed on: ['jived', 'hides', 'razer', 'zooks', 'jills', 'gibed', 'wises', 'yipes', 'wipes', 'sises']
Distribution of remaining candidates: [(4, 5), (3, 3), (2, 1), (5, 1)]
K=999:	Failed: 10	Accuracy:99.00%

Run Tests

python -m unittest runs the entire test suite.

Evaluation

Using a dictionary of scrabble words, there are 172,819 total words and around 5% of them are exactly 5 letters long (8,636). The algorithm devised achieves a 99.28% success rate at guessing the right word, failing to get the correct the answer for 62 words.

Other settings achieved:

  • Global character frequency heuristic: Couldn't solve for 133 out of 1000 random samples (86.7% Success rate)
  • Conditional character frequency heuristic, on candidates left: Couldn't solve for 100 out of 1000 random samples (90.0% Success rate)
  • Non-strict solution: Couldn't solve for 46 out of 1000 random samples (95.4% Success rate)
  • Position-aware frequency heuristic + bug fixes: Couldn't solve for 9 out of 1000 random samples (99.1% Success rate)

Future Work

  • Support passing in solver settings through command line, including the weight of NON_POS_WEIGHT
  • Support passing in a custom dictionary through settings
  • Expose customizable number of letters in the word (N) and MAX_GUESSES.
Owner
Debarghya Das
Debarghya Das
Open a file in your locally running Visual Studio Code instance from arbitrary terminal connections.

code-connect Open a file in your locally running Visual Studio Code instance from arbitrary terminal connections. Motivation VS Code supports opening

Christian Volkmann 56 Nov 19, 2022
Todo list console based application. Todo's save to a seperate file.

Todo list console based application. Todo's save to a seperate file.

1 Dec 24, 2021
Multifunctional library for creating progress bars.

πŸ‘‹ Content Installation Using github Using pypi Quickstart Flags Useful links Documentation Pypi Changelog TODO Contributing FAQ Bar structure βš™οΈ Inst

DenyS 27 Jan 01, 2023
Several tools that can be added to your `PATH` to make your life easier.

CK-CLI Tools Several tools that can be added to your PATH to make your life easier. prettypath Prints the $PATH variable in a human-readable way. It a

Christopher Kumm 2 Apr 21, 2022
CLI tool to develop StarkNet projects written in Cairo

OpenZeppelin Nile β›΅ Navigate your StarkNet projects written in Cairo. Getting started Create a folder for your project and cd into it: mkdir myproject

OpenZeppelin 305 Dec 30, 2022
Make tree planting a part of your daily workflow. 🌳

Continuous Reforestation Make tree planting a part of your daily workflow. 🌳 A GitHub Action for planting trees within your development workflow usin

protontypes 168 Dec 22, 2022
Features terminal for python

Features Terminal V1.0 (23/10/2021) Um programa para linux com diferentes ferramentas! Recursos: Criador de QR code Gerador de senhas Teste de velocid

1 Oct 26, 2021
Proman is a simple tool for managing projects through cli.

proman proman is a project manager. It helps you manage your projects from a terminal. The features are listed below. Installation Step 1: Download or

Arjun Somvanshi 2 Dec 06, 2021
A next-generation CLI and TUI that aims to be your personal assistant for everything competitive programming related. πŸš€

Competitive Programming Tool Kit The Competitive Programming Tool Kit (cptk for short), is a command line and terminal user interface (CLI and TUI) th

Alon 4 May 21, 2022
Just a shell writed on Python

HIGHSHELL (also hSH or HS) Just a shell writed on Python Send bug report β€’ How to use the shell β€’ Broked features β€’ Licenses How to use the shell Inst

0LungSkill0 2 Jan 04, 2022
A command line tool to remove background from video and image

A command line tool to remove background from video and image, brought to you by BackgroundRemover.app which is an app made by nadermx powered by this tool

Johnathan Nader 1.7k Jan 01, 2023
A command-line tool to upload local files and pastebin pastes to your mega account, without signing in anywhere

A command-line tool to upload local files and pastebin pastes to your mega account, without signing in anywhere

ADI 4 Nov 17, 2022
A Python3 rewrite of my original PwnedConsole project from almost a decade ago

PwnedConsoleX A CLI shell for performing queries against the HaveIBeenPwned? API to gather breach information for user-supplied email addresses. | wri

1 Jul 23, 2022
A lightweight Python module and command-line tool for generating NATO APP-6(D) compliant military symbols from both ID codes and natural language names

Python military symbols This is a lightweight Python module, including a command-line script, to generate NATO APP-6(D) compliant military symbol icon

Nick Royer 5 Dec 27, 2022
A tool to manage the study of courses at the university.

todo-cli A tool to manage the study of courses at the university

Quentin 6 Aug 01, 2022
Amazon Scraper: A command-line tool for scraping Amazon product data

Amazon Product Scraper: 2021 Description A command-line tool for scraping Amazon product data to CSV or JSON format(s). Requirements Python 3 pip3 Ins

49 Nov 15, 2021
a-shell: A terminal for iOS, with multiple windows

a-shell: A terminal for iOS, with multiple windows

Nicolas Holzschuch 1.7k Jan 02, 2023
A basic molecule viewer written in Python, using curses; Thus, meant for linux terminals

asciiMOL A basic molecule viewer written in Python, using curses; Thus, meant for linux terminals. This is an alpha version, featuring: Opening defaul

Dominik Behrens 328 Dec 11, 2022
Display Images in your terminal with python

A python library to display images in the terminal

Pranav Baburaj 57 Dec 30, 2022
A terminal slots programme in PY

PYSlots PyPI and Test PyPI External Links PyPI Test PyPI Install Look directly at the bugs! Version pip install pyslots "Don't look directly at the bu

Luke Batema 4 Nov 30, 2022