@nikku/wordle-solver

0.0.14 • Public • Published

Wordle Solver

CI

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

Readme

Keywords

Package Sidebar

Install

npm i @nikku/wordle-solver

Weekly Downloads

0

Version

0.0.14

License

MIT

Unpacked Size

156 kB

Total Files

8

Last publish

Collaborators

  • nikku