6 ms·
This is great! A few days ago, I wrote a Wordle solver in C. It selects a word to minimize the number of words assuming the worst-case green/yellow. So, it sou
by salomon812 5y ago
This is great! A few days ago, I wrote a Wordle solver in C. It selects a word to minimize the number of words assuming the worst-case green/yellow.
So, it sounds like these two are in direct conflict. My solver is deterministic, and it looks like the adversarial is too, so they always play the same game:
S E R A I (0 green, 0 yellow, 429 words remain)
M O L D Y (1 green, 0 yellow, 35 words remain)
C E N T U (0 greem, 2 yellow, 2 words remain)
V O U C H (4 green, 0 yellow, 1 word remains)
P O U C H (5 green, 0 yellow, 0 words remain)
- scubbo 5y agoI'd love to see your code! My strategy[0] (not-yet-automated) doesn't aim to minimize in the worst case, but rather to minimize the expected size of the set of possible words. [0] https://blog.scubbo.org/posts/cheating-at-word-games/ https://blog.scubbo.org/posts/cheating-at-word-games/
- salomon812 5y agoWow! I really like your analysis! Yeah, I was trying to determine the utility function that would determine how to select words, but I'm more of a gut-feel, intuitive sort of person. I also tried a squared term like yours, but for some reason, it didn't feel right when I tested it. That version decided the best initial word was `LARES`. I have a sneaky suspicion that we need to account for how common a word was. I think my solver was getting to hung up worrying about BRAXY and CRURA, and giving them similar weight to a word like TRACK. However, it was very hard to debug because a slightly buggy version was still decent at playing the game! In fact, I'm fairly certain I still have some bugs. I need to comment my code and get it up on Github. It's also super brute force O(n^2)
- salomon812 5y agoOkay, I ran it again with the squared term in the utility function. Here's what it did: L A R E S (0 green, 0 yellow, 576 words remain) T O N I C (1 green, 0 yellow, 50 words remain) B O O D Y (4 green, 0 yellow, 5 words remain) D E G U M (0 green, 2 yellow, 1 word remains) G O O D Y (5 green, 0 yellow, 0 words remain)
- boredguy8 5y agoHave you done any thinking about hard mode? Getting trapped in a 'deep' pattern (?ight: e, f, l, m, n, r, s, t, w) too soon seems like a problem. But this is way outside my bailiwick.
- klodolph 5y agoAre you using the same dictionary? I used the same technique, and got: NARES DOILY TOUCH And then VOUCH / COUCH / POUCH / GOUCH / MOUCH.
- salomon812 5y agoIt's very possible we don't have the same dictionary! I have 8938 words. I confirmed that NARES, DOILY, and TOUCH are in my dictionary. My analysis shows that SERAI's worst-case is 461 words and NARES would have 578. I found my code a bit difficult to debug at the end because it's still halfway decent at playing wordle. So, I fully admit I might not be doing it right! But one thing I also did was allow it to pick a word it knew wasn't possible but could eliminate a lot of possibilities quickly.
- deleted 5y ago[deleted]
- vitus 5y agoIt's worth noting that there are two dictionaries used in this implementation: "possibleWords" (from which the solution can be drawn) and "impossibleWords" (other words that are valid guesses). https://qntm.org/files/wordle/words.js https://qntm.org/files/wordle/words.js These are most likely the same words in the implementation at https://www.powerlanguage.co.uk/wordle/ https://www.powerlanguage.co.uk/wordle/ based on ["cigar","rebut","sissy","humph","awake","blush","focal","evade", showing up in the minified js (which are the first 8 words in possibleWords in order).
- salomon812 5y agoGood point! And it's clear to me that this isn't the dictionary I was using. I grabbed a random Scrabble dictionary online and filtered for length of five. I'll rework my code to take all this into account and we'll see what happens (it probably will happen later today.)
- 5y ago
- jameshart 5y agoA variation on this path that both uses more familiar words and sticks to 'hard mode' rules is ARISE MOLDY COUNT VOUCH POUCH
- bmitc 5y agoI've written a Wordle solver in F#. It's interesting because your first word contains the five most probable letters. My solver starts off by selecting, at random, one of the possible words that have these five letters. Could you say more how you've determined your solver to be deterministic in 6 steps? Also, I'm not sure I understand what this means: > It selects a word to minimize the number of words assuming the worst-case green/yellow. Particularly the part "assuming the worst-case green/yellow". Do you mind elaborating?
- salomon812 5y agoSo, my algorithm is deterministic because there isn't any random element in it. And then it appears the adversarial doesn't either because the game plays out the same way every time. So, to generate a single guess, the algorithm will basically try every single word in the dictionary against every possible remaining word. For any given guess, it tracks the count of various possible scorings. The scorings are the positions of greens, and yellows for a total of 243 possible scorings. After looping through all possible remaining words, it finds the max occurrence count within the scoring array. That maximum count becomes that guess's overall utility. It then finds the overall guess that minimizes that utility. (See: https://en.wikipedia.org/wiki/Minimax https://en.wikipedia.org/wiki/Minimax) After typing this all out, I feel like I didn't do a great job explaining, so let me know what you think.
- bmitc 5y agoThanks for the elaboration. I see what you mean by deterministic now. Is it also deterministic in the sense of always getting an answer within 6 guesses (maybe convergent is a better word)? (Maybe it's not possible to guarantee this. That's something I've been wondering.) My solver is a naive one at the moment, where I've only done a little analysis to get a good starting word. From there, my solver just tracks the results from each guess and randomly selects a word that meets the constraints for the next guess. That actually works surprisingly well, and it hasn't failed Wordle yet. I've been meaning to go back and do a more thorough analysis and create a more targeted strategy.