@nikku/wordle-solver
v0.0.14
Published
A Wordle solver.
Downloads
27
Readme
Wordle Solver
Get a little help solving your Wordle puzzles.
Usage
Try the demo.
Alternatively, use module exports:
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
.
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