Тёмный

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

ClarityCoders
Подписаться 49 тыс.
Просмотров 8 тыс.
50% 1

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/Cla...
You got something to say to me?? Join our discord!✌️
/ discord

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 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.
@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.
@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 :)
@lolwhatyesme651
@lolwhatyesme651 2 года назад
awesome video dude. got me motivated to actually start a new project haha
@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.
@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.
@HarelBrodai
@HarelBrodai 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.
@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}
@CreeperFace75
@CreeperFace75 2 года назад
using AI to make the perfect algo would be really cool!
@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.
@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.
@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
@marcellerich
@marcellerich 2 года назад
love it, keep them coming! ai would be great…
@ClarityCoders
@ClarityCoders 2 года назад
Thanks so much for watching and commenting.
@pauldoan1610
@pauldoan1610 2 года назад
Yes!
@ClarityCoders
@ClarityCoders 2 года назад
Paul! Thanks for watching and commenting I appreciate it.
@chrislevitt4929
@chrislevitt4929 2 года назад
Great video
@ClarityCoders
@ClarityCoders 2 года назад
Really means a lot thanks for taking the time to watch and comment.
@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.
@javan6982
@javan6982 Год назад
do it! Also, do you know Hanabi?
@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 ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-v68zYyaEmEA.html
@erner_wisal
@erner_wisal 2 года назад
Hi
@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
Просмотров 11 тыс.
Bot Plays Dino Run! Can our dinosaur bot be stopped?
11:30
25 nooby Python habits you need to ditch
9:12
Просмотров 1,8 млн
Solving Wordle using information theory
30:38
Просмотров 10 млн
Automating Android Games with Python: Stick Hero
15:22
Просмотров 384 тыс.