Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wordle-solver

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wordle-solver

This is a simple wordle helper / solver.

  • 1.0.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

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.

npm

npm

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:

game

Would be written as:

code

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!

FAQs

Package last updated on 04 Feb 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc