Coder Social home page Coder Social logo

aveek-saha / wordle-solver Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 11.47 MB

Solves the daily Wordle puzzle in hard mode and tweets it ๐Ÿฆ

Home Page: https://twitter.com/SolverWordle

License: MIT License

Python 100.00%
wordle wordle-solver wordle-game wordle-python wordle-solution information-theory entropy twitter-bot twitter-api

wordle-solver's Introduction

Wordle Solver

A solver for the official Wordle game in hard mode. The daily Wordle solved below by the bot is updated and tweeted on @SolverWordle automatically every day at 00:00 UTC.

Today's Wordle

Wordle 1042 3/6*

โฌ›๐ŸŸฉ๐ŸŸฉ๐ŸŸจโฌ›
๐ŸŸจ๐ŸŸฉ๐ŸŸฉ๐ŸŸจโฌ›
๐ŸŸฉ๐ŸŸฉ๐ŸŸฉ๐ŸŸฉ๐ŸŸฉ

Solution [Spoilers]

Answer: LARGE

T A R E S
E A R L Y
L A R G E

Rules

  • The bot plays Wordle in hard mode, i.e. any information from a guess has to be used in the subsequent guesses.
  • The bot uses the list of all valid words + the list of answers from the official wordle website, a total of about 13k words.
  • The list of possible answers is not given any special treatment and is mixed with the list of valid words.

Method used

The method used for this bot is inspired from a video made by 3b1b. The approach is similar, use entropy combined with a metric for how common a word is to rank guesses, but the implementation is different from what was shown in the video. For starters, this bot plays exclusively on hard mode

The metric to determine how common a word is comes from Lexipedia, which provides word lists extracted from Wikipedia articles. Lexipedia gives us the frequency of the words in these wiki articles, it also lets you filter the length of the words you need, 5 in our case. An English word frequency dataset from Kaggle is also used in combination with the Lexipedia frequency

A list of possible answers and valid guesses from the official website is used. The word frequencies are then normalized and we keep only the common words in the valid guess list for Wordle. If a word is present in the valid word list but not in the combined frequency dataset, we consider it's frequency to be 0.

Then the entropy is calculated for each word and normalized. To compute the total score for a word a weighted sum of the entropy and the frequency metric is taken. When we sort the list of the first guesses by score, the best first guess turns out to be TARES.

Then for each possible outcome after the first guess, the score for the best second guess is computed. This saves a lot of time when solving the Wordles. For every guess after that the score is calculated on the fly, this doesn't take too long as the number of possible words is usually small.

Stats

The bot was tested on all 2309 Wordle answer words and these are the results.

Regular

A regular test run means the result was considered a failure if the bot could not solve the puzzle in 6 or fewer tries. The average score excludes the failed puzzles.

Average: 3.927

Failure rate: 2.6%

Score # of games Graph
1 0
2 104
3 674
4 894
5 437
6 140
X 60

Extended

Just to see how the bot performed, it was allowed to continue playing beyond 6 tries till it found a solution. Overall the solver never takes more than 9 attempts to solve a wordle.

Average: 4.013

Score # of games Graph
1 0
2 104
3 674
4 894
5 437
6 140
7 48
8 9
9 3

wordle-solver's People

Contributors

aveek-saha avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gitshashwa-t

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.