https://github.com/codergautam/wordle-solver
A wordle solver.
https://github.com/codergautam/wordle-solver
wordle
Last synced: about 1 year ago
JSON representation
A wordle solver.
- Host: GitHub
- URL: https://github.com/codergautam/wordle-solver
- Owner: codergautam
- Created: 2022-01-30T18:56:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T00:42:35.000Z (over 4 years ago)
- Last Synced: 2025-02-07T05:31:39.428Z (over 1 year ago)
- Topics: wordle
- Language: JavaScript
- Homepage: https://wordle-helper.codergautamyt.repl.co/
- Size: 468 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Wordle Solver
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.


## Usage
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.
## filtering the wordlist
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.
## solving the puzzle
like I mentioned before, this module comes with 3 different wordle solving algorithms.
i will explain how to use them below
### experimental algorithm:
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()
```
### latest algorithm:
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.
### old algorithm:
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.
## contributing
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!