Using Python to play 100K Games of Wordle. Top Strategy Test!

  Рет қаралды 8,084

ClarityCoders

ClarityCoders

2 жыл бұрын

You might be playing wrong and not knowing it. I'll show how we can create a test game and run simulated strategies on that program. Python playing Wordle will show you how to create a similar project on any game or simulation.
github.com/ClarityCoders/Wordle
You got something to say to me?? Join our discord!✌️
/ discord

Пікірлер: 54
@paddym27
@paddym27 2 жыл бұрын
the key point you are missing from your algorithm is that you know that a certain letter cannot exist in a certain position if it is yellow. that really helps filtering. for example, the algorighm should never suggest 'lurid' after 'girsh' because it already knew that the 'r' cannot be in the third letter position.
@lolwhatyesme651
@lolwhatyesme651 2 жыл бұрын
awesome video dude. got me motivated to actually start a new project haha
@morpheus_uat
@morpheus_uat 2 жыл бұрын
YES i would love to see an ai handling this, maybe can figure it out on the second attempt if it was lucky?
@ClarityCoders
@ClarityCoders 2 жыл бұрын
I'm sure it could. I'll see what we can get figured out.
@user-jl7xw1oq5v
@user-jl7xw1oq5v 2 жыл бұрын
Great video! I would love to see another video on wordle and what an ML model could do
@ClarityCoders
@ClarityCoders 2 жыл бұрын
I will look into it this weekend.
@marcellerich
@marcellerich 2 жыл бұрын
love it, keep them coming! ai would be great…
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Thanks so much for watching and commenting.
@Fabsenet
@Fabsenet 2 жыл бұрын
so stretegy1 is basically one exploration round and strategy2 is 3 exploration rounds. you should test 2 and 4 rounds as well to find the real sweet spot
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Yes sir. Great thoughts. I also though maybe use machine learning to decide when to stop exploring. For example if you get 4 greens the first guess then go ahead and start guessing. If you get one yellow keep exploring.
@naptown9672
@naptown9672 2 жыл бұрын
Maybe keep stats on what exploration words have the best hit rate and use those first, also could find a relationship between possible words remaining, guesses remaining, and known/perfect letters to calculate when to switch from exploration phase to guessing phase.
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Good thoughts I'll look into it. Thanks for watching and commenting.
@Alexman208GR
@Alexman208GR 2 жыл бұрын
I checked the strat 2 and I don't see a filter for yellow letters that blocks words that have the correct letter but on the yellow's spot, which is already known to be the wrong location. Like if you get a yellow letter K at the first index, only words that contain K in all positions but the first one should be valid.
@austinschaffer7854
@austinschaffer7854 2 жыл бұрын
I had this thought too. Both strategies could be upgraded by keeping track of letters that can't appear in each spot.
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Great idea! I'll try and test and post back results.
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Great thoughts guys. Thanks for the view and comment as well.
@austinschaffer7854
@austinschaffer7854 2 жыл бұрын
@@ClarityCoders Sure thing! I'd love to see a comparison of before and after adding that as a minor optimization :)
@chrislevitt4929
@chrislevitt4929 2 жыл бұрын
Great video
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Really means a lot thanks for taking the time to watch and comment.
@narutocole
@narutocole 2 жыл бұрын
Such a sick video! Would love to see what an ML model could do!! It'd be interesting to see if it comes up with any new strategies on it's own!
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Thanks! I may look into hooking something up this weekend. I'll turn the game into a full gym environment.
@javan6982
@javan6982 Жыл бұрын
do it! Also, do you know Hanabi?
@kevinmckeown5506
@kevinmckeown5506 2 жыл бұрын
Been down a rabbit hole with the nltk word list to see if the letter_frequencies agreed, and then if the letter_frequencies for the 5 letter words were any different. First sidetrack was the nltk list has duplicates. That'll skew letter frequences. Remove them, original 236736 words becomes 235892 words. Second sidetrack was words starting with Capitals, e.g. Aries. Wordle doesn't accept these. Remove them, 210693 words left, of which 8497 are 5 letter words. Third sidetrack is some guesses then don't get accepted by Wordle. Remove lerot and ceryl, leaving 8495 words. Redo letter frequencies on those 8495 words, serai and arose are the first two guesses. Fourth sidetrack is then reading the other replies, and digging into the word list the game uses. I've posted below re: Wordle's 2315 words and their letter frequencies. Looking forward to your next video ;) frequencies for the list of 8495 words: {'a': 0.10514, 'b': 0.02735, 'c': 0.03639, 'd': 0.03293, 'e': 0.10015, 'f': 0.01556, 'g': 0.02594, 'h': 0.03114, 'i': 0.06075, 'j': 0.00384, 'k': 0.02076, 'l': 0.05574, 'm': 0.03062, 'n': 0.05211, 'o': 0.06593, 'p': 0.03043, 'q': 0.00198, 'r': 0.07163, 's': 0.05609, 't': 0.05604, 'u': 0.04427, 'v': 0.01097, 'w': 0.01612, 'x': 0.00445, 'y': 0.03778, 'z': 0.00588}
@HolyPT
@HolyPT 2 жыл бұрын
Quite funny, I use the 2 totally different words for the first two choices to cut down on my options and start trying to guess from the third onwards with the information I got. Worst case scenario is me only getting 1 vowel to be yellow but I removed 9 letters from my pool. Interested to see how does the AI "think"
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Like it I should try that as well. Thanks for watching and commenting.
@CreeperFace75
@CreeperFace75 2 жыл бұрын
using AI to make the perfect algo would be really cool!
@dominikzurek3874
@dominikzurek3874 2 жыл бұрын
The game's pretty similar to Mastermind(or Bulls and Cows), so I would look for inspiration there, since there are already algorithms that solve that problem under 6 moves in the worst case scenario. I suppose that it's harder when choices must include valid words and not only a combination of colors :)
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Haven't played it before I'll check it out.
@HarrisonBradke
@HarrisonBradke Жыл бұрын
Cows and bulls was the number version of wordle, wasted so much paper and ink doing it with mates in a boring class
@pauldoan1610
@pauldoan1610 2 жыл бұрын
Yes!
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Paul! Thanks for watching and commenting I appreciate it.
@daMozart
@daMozart 2 жыл бұрын
Great video. For me, part of the game is not only solving it, but solving it quickly. How are the results there? I guess the results would be equal or even better for Strategy 1, since spending 3 rounds on exploring seems like a little waste of time. But would be nice to have the facts.
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Good point. The two strategies were similar in time to solve round 4.7ish. Solving as quick as possible would be interesting as well. I'm sure the win percentage would take a hit.
@MrFoxBait
@MrFoxBait 2 жыл бұрын
There's another bit of knowledge you get while playing that didn't get factored in. I'm curious how it affects the two strategies: when you get a yellow letter, you know that it can never be correct in that position otherwise it would have been green. For example, @3:44, the strat guessed "girsh" followed by "lurid", but that wouldn't have been a valid guess if you made sure "r" couldn't be guessed again as the third character.
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Great point! I've had a couple people mention this I'll try to implement and post results. Thanks for watching and commenting.
@davidm.2260
@davidm.2260 2 жыл бұрын
There is already a pull request for this. It is doing about 93% win rate.
@TimBynum01
@TimBynum01 2 жыл бұрын
Machine Learning please!
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Got it on my short list now. I'm curious to see how it does.
@TimBynum01
@TimBynum01 2 жыл бұрын
@@ClarityCoders can't wait, thanks for the time you take to do these videos, they're great.
@dparker12997
@dparker12997 2 жыл бұрын
wouldn't an optimal guess just be a set of letters which eliminated the most words? Repeat until only one word left
@ClarityCoders
@ClarityCoders 2 жыл бұрын
How would you know how many words it eliminates until after you guess? For example my guess may return 5 grays on a certain word but the exact same guess on a different wordle would return 4 greens. The 4 green one would eliminate a lot more words. If you mean picking high frequency letters based on whats left that is a good optimization idea.
@dparker12997
@dparker12997 2 жыл бұрын
@@ClarityCoders you have a word list you are using right? This is effectively a 5d search space problem and you are trying to choose words which reduce the size of the remaining the most. Except you might get more info without using actual words. I would have 5 sets of 26 buckets to sort your word list into and choose letters with the most words in the bucket corresponding excluding duplicate letters.
@ClarityCoders
@ClarityCoders 2 жыл бұрын
@@dparker12997 I think I follow maybe not enough coffee today. Essentially what the word_score function is trying to do but accounting for letters you know are not in the word and such. Then you could choose an optimal guess.
@dparker12997
@dparker12997 2 жыл бұрын
@@ClarityCoders 3b1b basically made a video on this and actually coded it kzbin.info/www/bejne/rGebq4yvlqqge6M
@erner_wisal
@erner_wisal 2 жыл бұрын
Hi
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Oh hey!
@DaxtAttack
@DaxtAttack 2 жыл бұрын
AI!
@ClarityCoders
@ClarityCoders 2 жыл бұрын
My guy!
@darcipeeps
@darcipeeps 2 жыл бұрын
I believe I know of a better strategy
@ClarityCoders
@ClarityCoders 2 жыл бұрын
Don't hold out on us.
@asfgas
@asfgas 2 жыл бұрын
this video is very short and doesnt go over any of the code. either go into more detail or just post link to github. this is waste of time
@Alexman208GR
@Alexman208GR 2 жыл бұрын
He... did point to github. You should pay more attention before leaving such comments.
@asfgas
@asfgas 2 жыл бұрын
@@Alexman208GR you should read MY comment more carefully. i am saying its a waste of time if he makes a video without any more info than is already posted in the github. either post a video and make an effort to explain what is happening or just post a link (NOT A VIDEO WITH A LINK)
@ClarityCoders
@ClarityCoders 2 жыл бұрын
No worries I try to tell which type of video I'm doing right away. These ones with less of a code walk through are more for my audience that is pretty advanced in coding. They need more of inspiration and being pointed in the right direction. I understand that this can be frustrating for some. I'll be more clear in the future thanks for watching.
Python Bots! Coding a Better Auto Clicker.
15:19
ClarityCoders
Рет қаралды 11 М.
Perfect WORDLE algorithm (and how I found it)
18:03
Games Computers Play
Рет қаралды 11 М.
Joven bailarín noquea a ladrón de un golpe #nmas #shorts
00:17
КАК СПРЯТАТЬ КОНФЕТЫ
00:59
123 GO! Shorts Russian
Рет қаралды 3,1 МЛН
КАРМАНЧИК 2 СЕЗОН 5 СЕРИЯ
27:21
Inter Production
Рет қаралды 594 М.
Oh, wait, actually the best Wordle opener is not “crane”…
10:53
Bot Plays Dino Run! Can our dinosaur bot be stopped?
11:30
ClarityCoders
Рет қаралды 50 М.
Someone improved my code by 40,832,277,770%
28:47
Stand-up Maths
Рет қаралды 2,4 МЛН
Solving Wordle in under 3 guesses with python
3:40
The Dodgy Engineer
Рет қаралды 8 М.
How to play the Wordle Board Game
2:42
Triple S Games
Рет қаралды 66 М.
Wordle Champion - Coding Perfect Wordle Ai
13:10
Tech Tribe
Рет қаралды 10 М.
How Neovim saved me at least 30 minutes today
8:12
Rasmus Bergström
Рет қаралды 6 М.
Automating Android Games with Python: Stick Hero
15:22
Engineer Man
Рет қаралды 381 М.
The best Wordle strategy - according to science
12:33
Andrew Steele
Рет қаралды 889 М.
Doug plays today's Wordle Puzzle Game for 02/23/2024
5:21
Every Day Doug
Рет қаралды 1,8 М.
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Рет қаралды 6 МЛН
POCO F6 PRO - ЛУЧШИЙ POCO НА ДАННЫЙ МОМЕНТ!
18:51
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,7 МЛН
Apple watch hidden camera
0:34
_vector_
Рет қаралды 53 МЛН