https://github.com/nikku/wordle-solver
A solver for Worlde puzzles
https://github.com/nikku/wordle-solver
wordle wordle-solver
Last synced: 4 months ago
JSON representation
A solver for Worlde puzzles
- Host: GitHub
- URL: https://github.com/nikku/wordle-solver
- Owner: nikku
- License: mit
- Created: 2022-02-19T19:08:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T08:19:17.000Z (over 3 years ago)
- Last Synced: 2025-10-04T07:37:29.764Z (10 months ago)
- Topics: wordle, wordle-solver
- Language: JavaScript
- Homepage: https://nikku.github.io/wordle-solver
- Size: 610 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wordle Solver
[](https://github.com/nikku/wordle-solver/actions/workflows/CI.yml)
Get a little help solving your [Wordle](https://www.nytimes.com/games/wordle/index.html) puzzles.
## Usage
Try the [demo](https://nikku.github.io/wordle-solver).
Alternatively, use module exports:
```javascript
import {
suggest
} from '@nikku/wordle-solver';
const words = [ ... ];
const history = [
[ 'hands', Array.from('??--+') ]
];
const {
word,
progress
} = suggest(history, words);
// then
console.log('Suggested pick: %s', word);
```
## How it Works
The solver is implemented in [`lib/solver.js`](./lib/solver.js).
### Algorithm
Every pick it chooses the next word in order to reduce the solution space as much as possible.
* Accounts for historic picks (match, not matched, contained)
* Scores letter occurance per column and word
* Derives a word score
* Adds a penalty for letter duplicates
* Uses matched slots to guess / exclude likely letters
### Performance
Solves __100%__ of all puzzles in an average of __3.6 steps__.
```
$ npm run bench
...
W=1.000 S=3.559 R=1500
```
Solves __99%__ of all puzzles in an average of __4.1 steps__ when accepting the full dictionary as a solution:
```
$ FULL_DATA_SET=1 npm run bench
...
W=0.990 S=4.115 R=1500
```