Skip to content

Cornutum/wordles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wordles: Find the best Wordle guess

What's New?

What does it do?

wordles is a Java program to help you play the online game of Wordle.

You're given six chances to guess the five-letter word of the day, based on a few clues from your previous guesses. At each step, your first task is to think of words that match all of the clues. Hard! Then your next task is to pick a word that gives you the best chance to find the solution before you run out of tries. Easy, if you use wordles!

Given a list of words, wordles will analyze the possible results and rank these words in order of preference. Each word is analyzed by comparing it to all of the other input words, assuming that the other word is the actual Wordle target. The resulting matching clues are then used to organize all of the input words into groups. Printed results show all of the matching groups, along with statistics used to determine the rank of this guess word: the number of groups, the maximum group size, and the variance in group size.

How does it work?

wordles has a simple command line interface that you can run from a Unix shell. For details on how to download and install the wordles command, see How do I get it?.

Show the best word

wordles reads the word list from a file or from standard input. Here's a simple example.

echo "abuzz badly cocoa dogma gaudy laugh macho" | wordles

wordles then prints the result for the best guess word to standard output:

BADLY    [ 7 | 1 | 0.000 ]
--------------------------

  .yy..
    DOGMA

  GGGGG
    BADLY

  yy...
    ABUZZ

  .y...
    COCOA

  .Gy.G
    GAUDY

  .G...
    MACHO

  .G.y.
    LAUGH

This means that, assuming these are all of the possible matching words, the best choice for your next guess should be "BADLY". Why? Because even if you're wrong, you should be able to get the answer on your next guess. That's because Wordle will show you a different set of clues for each of these seven words. Even if your next guess is wrong, your chances of finding the solution are the same, no matter which clues you see. In other words, the variance in the size of all the possible matching groups is 0.000.

wordles shows you a simple text representation of the green, yellow, and white squares that the Wordle game displays as clues. For example, if you guess "BADLY" but the actual target word is "LAUGH", Wordle will display your guess like this:

⬜ 🟩 ⬜ 🟨 ⬜

With wordles this result is shown as ".G.y.".

Show the results for all words

Let's suppose all of the words from the previous example are listed in a file named myWords. Then you can print the results for all of these words with the following command.

wordles -a myWords

wordles then prints the results for all words in best-first order. As you can see below, the worst choice is "COCOA", which has a high variance (1.688). For example, what if you guess "COCOA" and produce the result below?

⬜ ⬜ ⬜ ⬜ 🟨

Bummer. There are four different words that match these clues. Now it will take an average of 2.5 more guesses to find the answer.

BADLY    [ 7 | 1 | 0.000 ]
--------------------------

  .yy..
    DOGMA
...

COCOA    [ 4 | 4 | 1.688 ]
--------------------------

  ....y
    ABUZZ
    BADLY
    GAUDY
    LAUGH

  .yG.y
    MACHO

  .G..G
    DOGMA

  GGGGG
    COCOA

Show results interactively

If you run wordles in interactive mode, you can enter any five-letter word you like and see its results when compared with the input word list. This can be helpful in a situation where the best guess to quickly narrow the possibilities might be a word that you know can't possibly be a match.

To see the next best choice from the input word list, just enter an empty word. To exit interactive mode, enter "q". You can use interactive mode only if the words come from a file.

For example, try this command:

wordles -i myWords

Then you'll see something like this:

BADLY    [ 7 | 1 | 0.000 ]
--------------------------

  .yy..
    DOGMA
...

Next guess? macho


MACHO    [ 6 | 2 | 0.139 ]
--------------------------

  .G...
    BADLY
    GAUDY
...

Next guess? elbow


ELBOW    [ 6 | 2 | 0.139 ]
--------------------------

  ...y.
    DOGMA
    MACHO
...

Next guess? 


DOGMA    [ 7 | 1 | 0.000 ]
--------------------------

  y.y.y
    GAUDY
...

Next guess? q

How do I get it?

To get the command line version of wordles, download the wordles shell distribution file from the Maven Central Repository, using the following procedure.

  1. Visit the Central Repository page for wordles.
  2. Find the entry for the latest version and click on "Browse".
  3. To download the shell distribution ZIP file, click on "wordles-${version}.zip". If you prefer a compressed TAR file, click on "wordles-${version}.tar.gz".

Extract the contents of the distribution file to any directory you like -- this is now your "wordles home directory". Unpacking the distribution file will create a "wordles release directory" -- a subdirectory of the form wordles-shell-m.n.r -- that contains all the files for this release of wordles. The release directory contains the following subdirectories.

  • bin: Executable shell scripts
  • lib: All JAR files needed to run wordles

One more step and you're ready to go: add the path to the bin subdirectory to the PATH environment variable for your system.

About

Finds the best choice from a set of Wordle word guesses.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages