A simple wordle solver for Node.js

Overview

This is just a weekend project, so take it easy :-)

simple-worlde-solver

Wordle solver for Node.js.

I am aware of other efforts that use greedy algorithms and similars, but in the end I wanted to adopt simpler strategies that could mimic how a human would guess words or could be executed by just evaluating properties of the words (e.g. not considering all the combinations of the words).

Dictionary

The dictionary has been copied from the Wordle javascript client. It is splitted in two blocks, one with the words among which Wordle selects a solution every day, and another one with all the possibile inputs. Of course the latter is bigger than the former. In total, summing up the two blocks, we have ~12000 words.

Interactive mode

You can use simple-wordle-solver to solve a Wordle puzzle by interacting with the process stdin.

Start the program with

node index.js

the output will be

step #1
remaining words = 12972
insert word (press ENTER to make a guess):

Here you can type a word or just press ENTER to make the program guess the next word to try.

By pressing ENTER the output will be:

picked "recal"
insert wordle color mask (0=grey, 1=yellow, 2=green, press ENTER to skip word):

Now it's again user turn, you need to inesert the result from Wordle by writing a mask of length 5 made up of 0, 1 or 2, where:

  • 0 -> grey
  • 1 -> yellow
  • 2 -> green

Now the program will eliminate the wrong solutions from the dictionary taking into account the mask and will prompt the user again for a new word.

mask "00110" step #2 remaining words = 203 insert word (press ENTER to make a guess): ">
insert wordle color mask (0=grey, 1=yellow, 2=green, press ENTER to skip word): 00110
[12972] word "recal" -> mask "00110"

step #2
remaining words = 203
insert word (press ENTER to make a guess):

The program will halt if a solution is found in under 6 steps or an error occurs.

Unattended mode

The program can also be launched in unattended mode.

node index.js 1000 1

The first paramer is the number of iterations while the second one is the guess strategy to adopt.

For any iteration the program will pick a random solution and then challenge itself by using the guessing strategy defined in the command line.

This is very useful for e.g. comparing different strategies in terms of speed, success rate and average steps needed to solve.

When the program ends it will present an useful summary.

total iterations	 = 10000
solved avg steps	 = 4.59
errors 			     = 0
solved %		     = 89.91%
unsolved %		     = 10.09%

Strategies

  • 0 : random guess among the remaining words

This works surprsingly well, with a success rate of ~90% in ~4.6 average steps. Of course it is the quickest strategy.

  • 1 : pick words with the higest number of distinct chars

This is the default strategy. It has a success rate of ~92% in ~4.5 average steps. It executes in reasonable time.

  • 2: pick words with the most frequent chars in the remaining words

This strategy proved to be very poor. It has a success rate of ~80% in ~4.9 average steps. It also is very slow, since it needs to re-calculate chars frequency at each step.

  • 3: mix 1 and 2, pick words with the most frequent distinct chars

This is the best strategy in terms of success rate (~94%) and average steps needed (~4.27). However it is as slow as 3.

You might also like...

Wordle but it's on your Terminal!

Wordinal Wordle but it's on your Terminal! What's Wordle? ๐Ÿค” Wordle is a classic word guessing game developed by Josh Wardle. Players have six attempt

Apr 12, 2022

I found 'WORDLE' game is hackable . we get solution on localStorage. I just prevented this.

WordleGame() Demo: https://shobdokhela.vercel.app Go play the real Wordle here Read the story behind it here Main Author Hannah Park Inspiration: I fo

Mar 6, 2022

๐Ÿ“Ÿ Chrome extension to solve Wordle puzzles.

๐Ÿ“Ÿ Chrome extension to solve Wordle puzzles.

๐Ÿ“Ÿ Chrome extension to solve Wordle puzzles. Learn to build Node.js CLI apps. wordle-solved ๐Ÿ“ฆ Chrome extension that solves Wordle puzzles for you ๐Ÿคฏ

Feb 8, 2022

Italian version of Wordle

Par ๐Ÿ‡ฎ๐Ÿ‡น le https://pietroppeter.github.io/wordle-it/ Una versione italiana (non ufficiale) di WORDLE. Se l'autore di Wordle non approva, lo tiro giรน:

Dec 18, 2022

A Wordle trainer, for the lols.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Mar 10, 2022

Chrome extension for the game called Wordle

Chrome extension for the game called Wordle

Chrome extension for the game called Wordle. No need to get stuck again while you have this at your side. Climb up that leader board!

Sep 17, 2022

A public JSON API for Wordle with vue.js frontend

A public JSON API for Wordle. This repo also includes a frontend made with Vue.js

Jan 1, 2023

JavaScript library guessing game, a Wordle clone

Jazle JavaScript library guessing game, a Wordle clone. A fork of cwackerfuss/react-wordle. See the list of accepted libraries: wordlist.ts Build and

May 26, 2022

Telegram Bot inspired by the Wordle game

Wordle Bot Give a try! @xWordleBot. This is a simple bot inspired by Wordle game. The bot is entirely written in TypeScript. Thanks to grammY Telegram

Oct 21, 2022
Owner
Alessandro Toppi
Alessandro Toppi
A clone of the popular Wordle game.

Wordle Clone How to play locally: yarn install

null 2 Jan 9, 2022
A clone of the popular game Wordle made using React, Typescript, and Tailwind

Wordle Clone Go play the real Wordle here Read the story behind it here Try a demo of this clone project here Inspiration: This game is an open source

Hannah Park 2.4k Jan 8, 2023
Wordle2Townscaper is meant to convert Wordle tweets into Townscaper houses using yellow and green building blocks.

Wordle2Townscaper Wordle2Townscaper is meant to convert Wordle tweets into Townscaper houses using yellow and green building blocks. You can download

Tarmo 66 Nov 2, 2022
Provides 5 keywords with which to narrow down your wordle game. I ruin nice things.

Widdle?? I hate fun so I wrote a script that ruins Wordle. This script can be used to find a Widdle, a set of five words that cover nearly all letters

Tess Myers 3 Mar 12, 2022
WORDLEBOARD prototype: Show your Wordle game on a Vestaboard as you play.

WORDLEBOARD prototype Show your Wordle game on a Vestaboard as you play. Copyright (c) 2022, Scott Schiller. MIT license. Made with love and fun in mi

Scott Schiller 7 Dec 20, 2022
CLI to to solve your Wordle puzzle daily

?? CLI to to solve your Wordle puzzle daily. Learn to build Node.js CLI apps. wordle-solved-cli ?? CLI that solves Wordle puzzles for you ?? Automatic

Ahmad Awais โšก๏ธ 8 Feb 2, 2022
A Wordle-like game where you have to guess the unsigned 8-bit binary number

Bytle A Wordle-like game where you have to guess the unsigned 8-bit binary number! Game coded in 2h 14m 50.570s, but it's not like I'm counting how lo

James Livesey 16 Jun 30, 2022
Latin Wordle is a free and open-source project that aims to provide a fun and interactive way to learn Latin.

Latin Wordle Live Game Here Inspiration Latin Wordle is a free and open-source project that aims to provide a fun and interactive way to learn Latin.

null 15 Dec 16, 2022
The extension to help you when you badly don't want to mess up your wordle streak

Your last resort in woordle to maintain your woordle win streak

Sreecharan 2 Feb 3, 2022
๐ŸŸฉ in case you want to cheat on your wordle games

Wordle Solver How to use Enter each right guess in the first grid Enter all letters that you know aren't in a certain position in the second grid For

James Zhang 2 Feb 7, 2022