Git Product home page Git Product logo

wordlexp's Introduction

Wordle Explorer

A reimplementation of Wordle built for exploratory data analysis.

Motivation

Everyone is going crazy over Wordle. There have been lots of conversations about what's the best starting word. Two suggestions I've seen are irate (proposed by a linguist) and later (proposed by a computer scientist).

As a bioinformatician, I thought it'd be fun to dig in and use my data-science training to find the best starting word.

But after my whole Saturday was spent looking at Digrams, and PCAs, and logo plots, I got tired and decided to just brute force the search.

The bot.

One thing that's bugged me about these best word conversations is 'BEST' is based on assumptions of how one plays the game. Bots with different strategies choose different starting words that work best for how they operate. What if we tried to minimize our assumptions about how the game is played?

Here, I've made a 'random' guesser that will play Wordle for us. This bot is probably above average in skill because it knows every possible 5 letter answer word and plays Wordle's hard mode perfectly. It looks at the space of valid, possible words and randomly picks one to be its next guess. To get the tables below, I had the bot use every valid word as it's first guess and then play with every valid word as the answer three times. That comes out to ~7.5 million games of Wordle, which took about 5 hours on 16 cores.

Then, all we need to measure is which word is "BEST" based on two factors:

  1. Speed - The number of guesses, ON AVERAGE, that a starting word takes to get to the answer
  2. Loss - The number of rounds, ON AVERAGE, that a starting word does not find the answer

Sure. Average enough. So what's the best word!?

Here are the top 5 fastest words.

word speed
STEAL 4.164
PLATE 4.165
BLAST 4.166
SLATE 4.166
PLANT 4.171

The fastest word seems to be steal, which wins in about 4.1 guesses. We can see that later is a fairly good (red line), but there are faster words.

Here are the top 5 winningest words:

word loss
SLEPT 7.156
SPLAT 7.271
PLANT 7.372
STOMP 7.372
CLAMP 7.401

Our least likely to lose word is slept, which lost only 7.1% of the time. We can see that later is average.

If you like to take a balanced approach to Wordle. The overall best words are (lower score is better):

word score
PLANT -2.235
BLAST -2.105
SLEPT -2.094
SPLAT -2.064
SPENT -1.955

๐ŸŒฑ wins!

But!, it won because our bot knows all the words. You can practice your Wordle-ing to learn more words and maybe develop a strategy better than random guessing with Wordle.ipynb. As you play, you can quickly get lists of possible guesses, tables of remaining letter frequencies, and plots of positional information.

Requirements

  • numpy
  • pandas
  • seaborn
  • logomaker
  • joblib
  • scikit-learn

Code

Run build_word_df.py to start.
See wordlexp.py for details on methods.
Brute force search done with score_words.py.
Code is very messy.

wordlexp's People

Contributors

acenglish avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.