wordle-sidekick

1.0.29 • Public • Published

Introduction

I think Wordle is actually more fun when you can cheat (just a little)! Use this CLI solver app when you play online, or play alone. It's also a great illustration of the application of Information Theory to play Wordle using a statistically optimal strategy. In the case of Wordle we want to maximize the amount of information that can be obtained from each guess by first computing the average expected value, also known as the Von Neumann entropy, for each word in the game's dictionary:

wordle3

A sorted list of word and entropy tuples is then used to play the game. See 3Blue1Brown's video Solving Wordle Using Infformation Theory for an excellent in-depth discussion of how the algorithm works.

It would be be boring if you cheated at every turn so don't! Play against a Wordle site and have a peek at the top guesses only when you're really stumped. It's fun to see how far you can get without a 'cheat' and a relief to know you can when you want to. You can also play with different word sizes: 4-10 chars are supported.

Example Usage

  1. Play against an online site, manually entering the hints the site provides (b/g/y are mnemonics for black, green, yellow):

wordle-sidekick

? Play mode: m

? Guess, hint: rates bybyb

... wordle0

  1. Play against the app:

? Play mode: a

? Guess: rates

... wordle1

Note:

  • You can hit 'q' at any time to quit. 'h' for help to come. 't' to see a play loop of 10 games with random words and guesses.
  • You can press return repeatedly while viewing the 'cheat' list to see more results (sorted by entropy descending)
  • An index value (1-99) can be used for any guess in the list as long as it is valid.

Try out other word sizes.

There's at least one site out out there which supports this that you can play against - https://wordlegame.org/ The nature of the game changes a bit for other word sizes, anyway they're interesting to watch in a play loop:

Pass either the word-size or the play mode on the command line or both:

wordle-sidekick 8 t

wordle4

Implementation

  • CLI is a simple JS file, written semi-pedantically to illustrate the algorithm.

  • Data fles (/frequencies/*.json) used by CLI are built by a straightforward Python file.

The word frequencies are incorporated to threshold guess choices, which is pretty neat and something I struggled with until I found 3b1b's video. All data files All entropy and frequency files are generated from google_word_frequencies and wordle_original_words using tools.py. I didn't think it worth it to put these in a dev dependency.

Package Sidebar

Install

npm i wordle-sidekick

Weekly Downloads

1

Version

1.0.29

License

MIT

Unpacked Size

6.14 MB

Total Files

18

Last publish

Collaborators

  • adriaanc