Wordle-solver - A simple solver for Wordle puzzles that uses letter- and word-frequencies to narrow down possible guesses

Wordle Solver

A simple solver for Wordle puzzles that uses letter- and word-frequencies to narrow down possible guesses.

Approach

Wordle maintains two word lists: a list of 2,315 solution words and 10,657 possible words. The union of these two lists forms the set of all valid guesses; other 5-letter words will be rejected from the game. This combined set forms the initial universe of possible words. The solver narrows this set until a solution is found.

For each guess, the solver first calculates the letter frequencies of the possible words. The candidates for the next guess begin as the set of words that contain the most frequent letter. From there, this set is narrowed by iteratively performing an intersection of the set with the next-most-frequent letter. The intersection operations continue until either the set has fewer than 10 guesses or the list of letters is exhausted.

When comparing the solution list to the possible word list, it appears that the words in the solution list are more common than the possible list, with the possible list containing some proper nouns and archaic words. To account for this, the solver selects a guess from the candidate list by finding the word that appears most frequently in the American National Corpus (ONC).

If the guess is incorrect, the solver will ask for the green and yellow letters. The solver will use this information to filter the universe of possible words. The words must contain any yellow letters, not contain yellow letters in positions that have already been considered, contain green letters in the correct spots, and not include any previous incorrect letters.

Once the universe is narrowed, letter frequencies are re-calculated and guessing repeats.

Running the solver

The solver requires a recent Go install (>1.11).

In the root directly, simply run go run cmd/main.go.

The solver assumes two files exist in the current directory: 1) words.txt, which contain the possible words to guess and 2) counts.txt which contains space-separated word frequencies.

Similar Resources

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent of Code 2021 Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved

Dec 2, 2021

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. This repository holds my submission/answers for these challenges.

Advent of Code - Zach Howell's Answers Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels

Jan 4, 2022

An annual Advent calendar of programming puzzles

An annual Advent calendar of programming puzzles

🎄 Advent of Code 2021 🎄 Summary Advent of Code is an annual Advent calendar of programming puzzles. This year I am doing it in Go and Python. Runnin

Jun 16, 2022

Advent of code — Programming Christmas Puzzles

Advent-of-code-2021 Advent of code — Programming Christmas Puzzles ★ - both the first and the second parts are solved ☆ - only the first part is solve

Dec 11, 2021

Solutions to the excellent yearly Advent Of Code puzzles

adventofcode Solutions to the excellent yearly Advent of Code puzzles - https://adventofcode.com I'll try to solve the previous years before 2022's Ad

Dec 13, 2022

Control external Fan to cool down your raspi cluster

Control external Fan to cool down your raspi cluster

Fan control for Raspberry Pi This is a small project that I build in order to cool down my raspi home cluster The case I use have some external fans t

Dec 11, 2021

Generate possible AD usernames from names like John Doe J.Doe or JDoe

GOtusernames Generate possible AD usernames from names like John Doe J.Doe or JDoe Example user file: ~/programming/golang/src/gotyourusername ❯ cat

Dec 13, 2022

Go-sudoku - Sudoku generator and solver implementation in GoLang

go-sudoku An implementation of Sudoku generators and solvers in GoLang. Usage He

Nov 7, 2022

A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell.

shellwords A Golang library to manipulate strings according to the word parsing rules of the UNIX Bourne shell. Installation go get github.com/Wing924

Sep 27, 2022
optwdl: Helpful word sets for solving Wordle puzzles

optwdl: Helpful word sets for solving Wordle puzzles. Wordle gives you 6 tries to identify a 5 letter word. I decided to look for sets of 5 words that

Jan 24, 2022
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar

Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star.

Dec 6, 2021
Wordle - Simple wordle solver with golang

wordle Simple wordle solver Lets see it in action: $ ./wordle 5914 possible rem

May 19, 2022
Solver for wordle hard mode - achieves 5 attempts or less 100% of the time

wordier Solver for wordle hard mode - achieves 5 attempts or less 100% of the time Example - Spoiler ➜ wordier git:(master) ✗ go run main.go scamp ➜

Jan 12, 2022
Wordle - Wordle on command line

wordle Play WORDLE on the command line. Installation go install github.com/howey

May 19, 2022
Wordle-guesser - Implementing brute force wordle guesser

wordle-guesser Project still WIP. Wordle guesser. Implementing brute force wordl

Jan 24, 2022
Wordle - A terminal Wordle written in Go
Wordle - A terminal Wordle written in Go

Wordle A terminal Wordle written in Go. Running If you couldn't tell from the im

Dec 26, 2022
Wordle - Wordle game in Go
Wordle - Wordle game in Go

wordle wordle game in Go rules - You have 5 guesses - You can only guess using 5

Feb 26, 2022
Go-wordle - Wordle implementation in GoLang
Go-wordle - Wordle implementation in GoLang

go-wordle A golang implementation of the popular New York Times game Wordle. Usa

Dec 12, 2022
go-wordle - Wordle in terminal, written in Go
go-wordle - Wordle in terminal, written in Go

go-wordle go-wordle is a simple console application that allows user to play Wordle game in terminal. It is synchronized with official New York Times

Feb 19, 2022