Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
wordle-solver
Advanced tools
This is a simple wordle helper / solver.
This is still in development, so expect breaking changes with every update.
This module comes with 3 algorithms, all very good at solving wordle.
First install the package
npm i wordle-solver
Then import the Solver class, it's what does all the heavy lifting.
var Solver = require("wordle-solver")
Create a new instance of it.
var solver = new Solver()
This will automatically create a new Solver and populate it with the latest wordlist.
If you ever want to modify or look at the wordlist, you can use:
solver.wordlist
Now, for the cool part
You can filter the wordlist by doing:
solver.guess(word, output)
word
is a string containing the 5 letter word that was guessed.
output
is a string containing the output of that word.
For example:
This game:
Would be written as:
This will log an array with the remaining possible words.
For your convenience, this module offers an easy way to get the possible solutions based on your previous guesses.
You can retrieve this with:
solver.getPossibleWords() //returns array
If you want to find the best guess to play, keep reading.
like I mentioned before, this module comes with 3 different wordle solving algorithms.
i will explain how to use them below
this is an algorithm inspired by Tom Neil. it's pretty good but it's not fully completed yet. i don't think i will ever get to completing it.
To find the next best guess at any given state:
solver.nextBestv3()
this was an algorithm i saw, inspired from Max Kreminski. I ported it to work with this module. it's able to solve most words pretty quickly.
To find the next best guess at any given state:
solver.getNextBestGuess()
This will return a string containing the best next word to play.
You can also get an array of the best guesses, sorted from best to least, with:
solver.getNextBestGuesses(n)
In the above example, n is the number of guesses to fetch. If you wanted the top 10 guesses, you would put 10 instead of n.
this was the first algorithm I created. it works by assigning weights based by probability. it isn't that good but you can still use it nevertheless.
To find the next best guess at any given state:
solver.nextOldSolver()
This will return a string containing the best next word to play.
You can also get an array of good guesses, sorting from best to least, with:
solver.oldSolver(n)
In the above example, n is the number of guesses to fetch. If you wanted the top 10 guesses, you would put 10 instead of n.
if you find this useful, please leave a star on github!
if you find any bugs with this, please open an issue.
you can also submit a pull request to add new features!
FAQs
This is a simple wordle helper / solver.
We found that wordle-solver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.