Solving Wordle in under 3 guesses with python

preview_player
Показать описание
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
Рекомендации по теме
Комментарии
Автор

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.

shopt
Автор

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

confused
Автор

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)

fanytasticsone
Автор

Welcome to the Wordle Solver!
The suggested starting word is: slate
Enter your first guess:
slate
Enter your first result:
wwyyy
['begat', 'adept', 'after', 'facet', 'agent', 'water', 'taken', 'terra', 'cadet', 'tweak', 'wheat', 'taker', 'extra']
The suggested word is: taker
Enter your next guess:
taker
Enter your new result:
ggwgg
[]
Oh no! You made a mistake entering one of your results. Please try again.

=== Code Execution Successful ===


I am getting this issue my word is taper, which is present in your dictionary

aswinr
Автор

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

izxepfq
Автор

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

alebr
Автор

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

zMarcusHD
Автор

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

scamperYT
Автор

would love a tutorial on how to download this

KillBill
Автор

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?

yuechen-jcfc
Автор

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

marcosgarces
Автор

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

anirudhraovasudevarao
Автор

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

Vee-Hive