Solving Wordle in under 3 guesses with python -

Solving Wordle in under 3 guesses with python

The Dodgy Engineer
Views: 3259
Like: 63
Wordle is a simple word game that recently exploded on the internet. Everyone tries to guess in as few attempts as possible, so I wrote an algorithm in python to maximise my performance.

With a mean guess number of 2.95, my program is near optimal. I was inspired to create this project after watching a video by 3Blue1Brown, and against all odds, my results seem better than his!

If you have any questions, please drop them in the comment section! Here’s a link to the code:

#wordle #solvingwordle #bestwordleword


  1. Can I use this in one of my personal projects, it'll be used in a public github repository? I would credit you and drop a link to this video. Thanks

  2. @TheDodgyEngineer what do possible_words and frequencies correspond to in the function you defined?

  3. could you plz share the code of the results that showed at 3:02? how does the code run itself and compute the average number and runtime?

  4. Just stumbled across this. I think there are a couple of things which make this look better than it is.Firstly using the wordle answer list ranges from cheating to merely overfitting depending on your point of view. Having said that, 3Blue1Brown gets around 3.4 even when using the wordle answer list.Secondly, you say you are removing answers that have previously appeared. That's what allows you to beat 3Blue1Brown and most of the other solvers out there, which start with a clean slate (no I didn't pick that word deliberately) for each word they are solving.It's an interesting approach (it's similar to the one I used in my first solver, though I used the sum of the logs of the letter counts instead, your scoring is probably better). I've implemented another solver similar to the 3B1B approach, it will be interesting to see how it compares to your numbers if I also drop already seen answers each time. I may get around to that and report back.

  5. would love a tutorial on how to download this

  6. Why is the frequency in Xyzaa not “0,0,0,1,2” for the letter ‘a’

  7. Could you upload many videos about your sixth form tips or studying tips?

  8. no way are you getting under 3 guesses with a dictionary of 13000 words!

  9. is the code uploaded to github if yes could you share it?

  10. hmm i tried implementing this solving algorithm into my wordle api and i am only getting a 90% solve rate. it seems to do really well for the most part until for example, i get to a word like 'joyed', where it ends up cycling through a bunch of _o_ed words seemingly at random before failing. i.e. it played coned, bowed, doped, domed, joked.

    is it possible i have implemented it incorrectly? my api gives me a list of remaining words, and from that i am able to create a dictionary of letter frequencies in position. then i was able to essentially copy and paste the algorithm on screen and generate a list of words and their respective scores and play the word with the lowest score. I also began each turn with slate.

    is there a reason why you haven't posted this up on github? if it actually can on average get it in 2.9 guesses, that is pretty remarkable for such little code

  11. i ran the py file in the description but it just closes instantly, please help

  12. I recreated your program on my own, but there's a thing. In 2:37, Why you choose cumulative multiple product, rather than comparing euclidean distance? (or vector difference)

Leave a Reply

Your email address will not be published. Required fields are marked *