13 ms·
Solving Wordle in 3.64 guesses on average, 99.4% of the time
- SoylentOrange 5y agoThis solution feels a little like cheating because it's using the "target" list to train. The target list contains all the solutions, while the larger list contains all 5-letter words. A human would not know the target list. For a more fair solver, it should add the two lists together to train, and then test on the target list.
- anotheryou 5y agoWhy optimize for greens? Better to rule out more first no matter the position. I think it narrows the search space better. If you want to go fancy somehow calculate with bigramms. If you guess c you don't have to guess k blindly too, etc.
- tomlockwood 5y ago> Why optimize for greens? Better to rule out more first no matter the position. I haven't yet experimentally tested this, but I hope to soon! It may be that a green letter in position rules out more possible targets than a grey letter.
- anotheryou 5y agoI thought of yellows. Taking frequent letters over words with sub-optimal letters but in the right positions. But manually I'm no where close to 3.6 either :). Also often too lazy.
- tomlockwood 5y agoYeah, I think my average is closer to 4, ugh! But the program has shown me some strategies that seem interesting. It always guesses "slate" first, and if that has no greys it guesses "crony", and that one-two punch seems to do me well fairly often.
- anotheryou 5y agointeresting :) I go for "torah", "lines", ("ducky", but I think the k is far from optimal) apart from "h" and "i" it's the same letters (and I do have c and y in my optional 3rd).
- amluto 5y agoIf you want to get really fancy, a full minimax solution is probably feasible without massive resources. Pretend it’s a two player game with one player guessing and the other player thinking of a potentially different word for each guess subject to the constraint of being consistent with all previous answers.
- ummonk 5y agoSomebody had already tweeted about solving it and finding that 3 guesses suffice, using alpha beta search (though he didn’t use the term “alpha beta” because he might have reinvented it). Unfortunately, I can’t seem to dig up the tweet.
- ford 5y agoThere is a wordle parody (absurdle) [0] that does exactly this. [0] https://qntm.org/files/wordle/ https://qntm.org/files/wordle/
- pxx 5y agoNo it does not. It uses a heuristic at every layer of the tree. Specifically, instead of recursing down each subtree, it chooses the set with the maximum number of remaining elements, which isn't necessarily the set that is most difficult to split.
- ford 5y agoI see - I misunderstood the parent comment. I believe you are saying that the best adversary would attempt to maximize the depth of the tree. For example a branch with "{L, B, C, R, ..}ake" requires more guesses than a balanced tree despite the fact that the two trees may have the same number of nodes.
- sdwr 5y agoIf you want to split hairs, minimax is optimal for worst-case, but not for bringing down the average # of guesses.
- canjobear 5y agoThe generally optimal thing is to choose guesses to reduce the set of possible targets as much as possible. This is the same as choosing guesses with maximal entropy over the resulting patterns (that is, the result you get back from the game should be maximally informative). Because greens are rare, by maximizing the probability of greens, you are approximately maximizing the entropy of patterns, by distributing probability mass among rare patterns. This is why going for greens is a good heuristic.
- ascar 5y agoThis sounds like the optimal strategy for a single guess. But shouldn't the optimal strategy for solving the game include that there are multiple guesses? While some specific word might provide the highest reduce in entropy for the first guess, it might actually negatively impact the entropy reduction of remaining possible words compared to another first guess. E.g. if RAISE is the optimal reduction in search space for the given word list, what's the best 2nd guess for every possible word? Now taking the average 2nd guesses into account, is there a better first guess?
- canjobear 5y agoGood point. Because the set of possible guesses is constrained, the totally general solution needs to take future guesses into account. There doesn't seem to be a way to find the optimal guess other than searching the whole game tree (which it looks like someone in another comment did).
- prezjordan 5y agoIt's interesting to see the edge cases where the algorithm struggles to find the last letter. > shave: [slate: 20202, share: 22202, shame: 22202, shape: 22202, shake: 22202, shade: 22202] I guess it needs to find the right choice of [r, m, p, k, d, v] to get "shave" (since 'v' is so rare it takes 6 guesses!). Trying "marks" and "paved" would narrow that list down in 2 guesses (and a third to actually try "shave") Anyone code this up yet? (I haven't, I took a greedy approach too [0]). Wonder how to generalize such a plan. [0]: https://github.com/jdan/wordle.ml https://github.com/jdan/wordle.ml
- tomlockwood 5y agoYeah, I don't want to give the game away on my next program but its along those lines, and there are some challenges to making it work that I'm still figuring out haha.
- muti 5y agoThe solver is playing in "hard" mode, where any yellow/green letters must be used in further guesses
- RivieraKid 5y agoWhy not simply choose a guess which narrows the set of possible solutions the most? This could be improved by looking one step further, but this would probably require some kind of optimization / heuristic / approximation to make it computationally feasible.
- tomlockwood 5y agoWatch this space :D
- Retric 5y agoIt really depends on what you are trying to optimize. Least guesses on average may not want a 50/50 split it might want say a 60/40 split where the 60% is 2 guesses and the 40% is 3. But that loses to a 48:52 split which gives 2 guess 80% of the time etc.
- noxvilleza 5y agoNarrowing the search space greedily doesn't solve the problem optimally, because the size of the search space is just a heuristic. Some search spaces of size X might be more difficult to reduce further than another search space of size Y (for Y < X). This is more apparent in hard mode where you have a very limited guess-pool. The greedy heuristic approach would work fine if all possible 5-letter combinations were valid answers.
- RivieraKid 5y agoI know, like I said in my comment, this greedy strategy could be improved.
- Edman274 5y agoIf you right off the bat guess "bound" and then positions 2, 3, 4, and 5 all come up green, then your goal needs to then be to use words like 'morse' to rule out (in one fell swoop) words like 'sound', 'mound' and 'round'. Then, if it's not ruled out, you can then choose words that just have m and s, or s and r.
- muti 5y agoThis is a valid strategy in easy (default) mode, but in "hard" mode, you must use all yellow/green letters in subsequent guesses
- canjobear 5y agoGoing for greens is a good heuristic, but the general solution is to seek guesses that shrink the size of the set of compatible words the most. https://langproc.substack.com/p/information-theoretic-analysis-of https://langproc.substack.com/p/information-theoretic-analys...
- zeroonetwothree 5y agoUsing essentially this method I get that the best initial guess is RAISE (there are some others that are very close). It seems the author of this post didn’t use the actual word list from the game so got a different word.
- tomlockwood 5y agoI used the actual wordlist, yoinked out of the javascript with my totally elite dev-tools-in-chrome-hacking! But yeah, given the frequency of letters, in position, in the target list, the answer is SLATE.
- canjobear 5y agoYeah when I ran my script using the real wordlist I got RAISE too. (Just updated the article.)
- loeg 5y agoFor me, ARISE and RAISE were equally good.
- OJFord 5y agoOr, especially in first guess or so, shrink the set of letters used by the remaining compatible words, which is subtly different right?
- npinsker 5y ago> From an information-theoretic perspective, the optimal initial guess is the one which is maximally informative about the target, given the resulting pattern. This statement (which motivates the rest of the analysis) isn't correct, because it doesn't take into account the highly irregular search space of what you're actually allowed to guess. Sets of possible words can vary a lot in terms of how easily they can be further cut down: for example, if you're on hard mode and your set of possible words is [BILLY, DILLY, FILLY, HILLY, SILLY, WILLY], then you might be in trouble.
- npinsker 5y agoI wrote a solver a few weeks ago that solves easy mode in 3.45 guesses and hard mode in 3.55 guesses. Rather than using heuristics, it explored a large portion of the game tree (with a little pruning) and I'm hopeful that it's optimal. Interestingly, the EV-optimal hard mode strategy takes 3.52 guesses on average, but requires 7 guesses a tiny fraction of the time, so I instead exposed the best strategy that always requires 6 or fewer guesses. If you're interested, you can play with it here: http://www.npinsker.me/puzzles/wordle/ http://www.npinsker.me/puzzles/wordle/ and the source (written in neophyte's Rust) is here: https://gist.github.com/npinsker/a495784b9c6eacfe481d8e38963b335c https://gist.github.com/npinsker/a495784b9c6eacfe481d8e38963... (edit: It's posted elsewhere in the thread, but this is actually not optimal and someone else achieved better results! http://sonorouschocolate.com/notes/index.php?title=The_best_strategies_for_Wordle http://sonorouschocolate.com/notes/index.php?title=The_best_...)
- tomlockwood 5y agoOh dang! I was guessing that the optimal approach would be under 3.5 for easy mode, but was expecting it to be closer to 3! Amazing work. My next go at the problem is in Rust, which I am a total newcomer to. Thanks for sharing!
- hgibbs 5y agoAs a point of curiosity, what do you mean by optimal? To me, I can see at least two (potentially different) cost functions that a Wordle strategy can aim to minimise. Firstly, you can try to minimise the expected number of guesses, and secondly you can try to minimise the expected number of guesses conditional on never losing the game. In principle you could optimise for the first but not the second by allowing a small list of hard words to take > 6 guesses on average. Part of my point is the lack of an absolute definition of optimal: strategies are only optimal up to the specified coat function.
- furyofantares 5y agoThey specified that in the post, they were able to constrain to a strategy that guarantees 6 or fewer and then optimize for EV to get 3.55, but could get down to 3.52 by allowing some small number of words to take more than 6. I would be interested to know if 6 is the lowest you can constrain it. Can you guarantee a solution in 5, and if so what is the best EV with that constraint?
- s_Hogg 5y agoThis is really interesting, well done :) As it stands, it seems like your algo will always use the same first guess, have you thought about making that configurable and seeing what happens with e.g. the number of words where it gets stuck and runs out of time?
- tomlockwood 5y agoGet to work Mr. Hogg! Yeah, next program will effectively do this but in an utterly insane way. Shall we brunch to discuss soon?
- Grustaf 5y agoAs many have mentioned, it seems much more efficient to focus on eliminating letters, which means that the second word should not be very green at all. Also, since there's only one word a day, I think we can assume that it's chosen manually, and it won't be some archaic anglo-saxon tool for shoeing horses or something, it will be a relatively common word.
- tomlockwood 5y agoI think it's chosen based on a random number generated from the date - but one of the most recent games had the answer "REBUS", which I've never heard or read before. But yeah, the target list has many more common words in it than the list of all possible guesses.
- Grustaf 5y agoThat is not an uncommon word though, I'd venture most school children know it. You probably read rebuses in school but just forgot about it!
- tomlockwood 5y agoIt's a common word? What's your source for that claim?
- Grustaf 5y agoKindergarten? https://kidpillar.com/free-rebus-puzzles-for-kids/ https://kidpillar.com/free-rebus-puzzles-for-kids/
- tomlockwood 5y agoThis website looks like it's target audience is five year olds, to you?
- Grustaf 5y ago
- hoten 5y agoJake Archibald shared an implementation that aims to narrow the search space the most with each guess. https://twitter.com/jaffathecake/status/1483057877875101697?s=20 https://twitter.com/jaffathecake/status/1483057877875101697?...
- bbasketball 5y agoIf you like Wordle you should check out https://wordhoot.com/ https://wordhoot.com/
- BoorishBears 5y agoI thought the UI of Wordle wasn't anything special but this makes me appreciate the subtle attention to detail that went into it That website you linked doesn't lock the viewport so on my phone it's constantly panning or randomly zooming And the grid instead a keyboard layout actually matters more than I expected for how easy it is to type Having to manually start a game is a tiny thing but doesn't feel as smooth
- julianwachholz 5y agoRecreating the game from scratch I noticed a ton of these tiny little details that went into the game which made it even more fun of a challenge. I'm looking forward to trying to implement these subtle animations, too.
- bbasketball 5y agoIt's click to start because it has a timer. Hmm, I'm not seeing the other issues.
- WordHoot 5y agoAre you still experiencing the panning/zooming issue? If so please let me know and I will look into it. I've updated keyboard layout. Thanks!
- CarVac 5y agoIt looks like the losing cases are those where in hard mode you can easily get 4 of the letters correct but you have more potential words than guesses left.
- tomlockwood 5y agoYeah, it requires more analysis but I think counterintuitively many of the games that go up to 5-6 are ones where the initial guesses get a lot of greens, effectively making the remaining guesses a set of 50/50s.
- matthewfelgate 5y agoThanks for sharing. I have a feeling that a perfect algorithm should be able to solve all wordles in 4 guesses. (but I might be wrong) The problem with a lot of approaches is they seem to locally optimise for each guess rather than optimise over all the guesses (if that makes sense?) I get the feeling guessing the most frequent letters might not be the best approach, because does it cut down the number of possible words much? My intuition tells me if you have the right first 3 guesses you should be able to cut the dataset down to 1 possible answer every time. However I don't know how to program it.
- shagie 5y agoA bit ago on HN there was a link to Evil Wordle - https://swag.github.io/evil-wordle/ https://swag.github.io/evil-wordle/ ( https://news.ycombinator.com/item?id=29864418 https://news.ycombinator.com/item?id=29864418 ) and there's another variation of it at https://qntm.org/files/wordle/ https://qntm.org/files/wordle/ On NPR ( https://www.npr.org/2022/01/23/1075168693/youve-heard-of-wordle-now-get-ready-for-sweardle-and-absurdle https://www.npr.org/2022/01/23/1075168693/youve-heard-of-wor... ) > QNTM: So with Wordle, in theory, you can win in one guess. I've won in two guesses a couple of times. Absurdle - you cannot beat it in less than four guesses. Four is the limit. But generally just good luck - you're going to need it. The worst case for Wordle and evil world or Absurdle should be the same... its just that evil and absurd are always the worst case.
- thxg 5y agoThis [1] solves it in 3.4212 average guesses 100% of the time and claims optimality, which is 99% of the difficulty it seems. For the limited 2671-word set of possible words, I think the question is now settled (for the whole 12k-word set, I don't think anyone tried anything). It was posted here four days ago [2]. [1] http://sonorouschocolate.com/notes/index.php?title=The_best_strategies_for_Wordle http://sonorouschocolate.com/notes/index.php?title=The_best_... [2] https://news.ycombinator.com/item?id=30006724 https://news.ycombinator.com/item?id=30006724
- thxg 5y agoOk, I found this one [1] with 100% wins on the whole 12k-word set. But it optimizes for worst-case, not average. [1] https://www.poirrier.ca/notes/wordle/ https://www.poirrier.ca/notes/wordle/
- ottowinter 5y agoNeat, didn't know that existed! Definitely would have saved me some time :) FWIW, I wrote a similar solution a couple of days ago as well, and come up with the same result (3.421166 guesses on average, with starting word SALET). So that would support that result. With the following strategy: https://drive.google.com/file/d/1WvxRRzbvDVnHZUczHBZAko3hKfttGZ3J/view?usp=sharing https://drive.google.com/file/d/1WvxRRzbvDVnHZUczHBZAko3hKft..., code: https://drive.google.com/drive/folders/1Y8k685PS0wxvYulIxsPgf4te-GvGDKlq?usp=sharing https://drive.google.com/drive/folders/1Y8k685PS0wxvYulIxsPg...
- hddqsb 5y agoThere is a leaderboard at https://botfights.io/game/wordle https://botfights.io/game/wordle for solving with all 12972 words as possible solutions, it might be of interest.
- hnkain 5y agoIt's a bit disappointing that there's been many writeups of heuristic-based solvers make the front page, but the writeup of an exact solver doesn't make it. [Note: I was the person who submitted the link to the exact solver writeup to HN]. https://news.ycombinator.com/item?id=30006724 https://news.ycombinator.com/item?id=30006724
- LeoPanthera 5y agoSee also Absurdle, an adversarial Wordle that is designed to be as difficult as possible: https://qntm.org/files/wordle/ https://qntm.org/files/wordle/ I won't spoil how it works, but click the "?" button on the page if you want to know.
- pxx 5y agoIt's designed to be, but it isn't necessarily, as it uses the size of the remaining solution set as a heuristic for how many guesses are needed to split it. There are better, more exhaustive searches of the solution space now.
- d4rkp4ttern 5y agoSince it is adversarial, it is also deterministic, I.e, for a given play, its response will always be the same. So the challenge here is no longer, “can you guess THE word?”, but rather, “can you find the shortest play?”. Finding a 5-step solution is reasonably challenging, but try for a 4-step solution, it will drive you nuts :) Some have been posted on Twitter but that’s no fun.
- vba616 5y ago>so far what was taking 1GB of RAM in Python is taking, literally 1MB in Rust Is anybody hiring people to fix situations like this at work? i.e. this script that was written in a hurry needs to be revised to be 10^3 times more efficient, in space or time.
- tomlockwood 5y agoAs a data engineer, I sometimes run into problems like this, but I generally find that 99.9% of them can be solved "well enough" in python, or in a database. Moving code from Python to Rust or similar has been required only a handful of times. This specific task, the next program I'm working on, seems to be a very "algo" based, comp sci type problem. I think most companies want to say that they have these kind of problems, but the reality often is, they need a batch script on a laptop. So like, yeah, I have done things like this before in my work, but often, solutions in Python are "good enough".
- dvasdekis 5y agoA company I know hired a computer science PhD after putting them through the full programmer interview, including whiteboarding algos, etc. Literally the hardest crap that anyone working there could think up, and then hired the programmer who got the best score on the test, and the process took multiple months to find this magic individual who could score high enough to satisfy everyone. Once hired (at a fantastic salary), she was then put to work copying data from a pile of CDs into a cloud storage account! Not only that, but she was given a laptop with only 1 CD drive to work with. She quit within a week.
- vba616 5y agoI have trouble believing that story. An adult, who is also a super genius just says "I was given..." and quits? That's so passive! You have one CD drive and assume that's it, nothing can be done, that's all the resources in the whole company? Don't talk to anyone?
- 5y ago
- gbronner 5y agoThe objective function is weighted average number of guesses, with some penalty factor for >6 (aka losing), and optionally different weights for getting it in 1,2,3,4,5,6 And you can solve it in a tree- at least for the lower levels when the search space has been reduced
- julianwachholz 5y agoWordle is a perfect example of nerd sniping, I couldn't stop playing once I started. But I wanted to challenge my friends to some more difficult puzzles and wrote a tiny tool this weekend to do just that! You can create your own Wordle-like puzzles on https://word.rodeo https://word.rodeo I've already received a ton of positive feedback from friends. What are your thoughts?
- depaulagu 5y agoIt's not copying the URL to my clipboard, would it be possible to expose the url as text so manual copying can be done?
- julianwachholz 5y agoMy partner noticed this too, but after a couple of tries the same button will work again. Really hard to debug unfortunately. It usually worked after a couple of tries. I just pushed a fix that greys out the link if there's no URL, hopefully that helps?
- BoorishBears 5y agoCan you really not just share the url and at most pre-highlight it? On my phone I get a share sheet with additional text which makes visiting the url a pain
- julianwachholz 5y agoIt's a normal anchor tag so you can right click or long press it to copy the link!
- SamBam 5y agoDoesn't work for me either, after many clicks. macOS 11.6, Chrome 96.0.4664.55.
- 5y ago
- lottin 5y agoYou can solve it with grep and /usr/share/dict/words but where's the fun in that?
- Phylter 5y agoThe answers are all in it's JavaScript source code, but what's the fun in that?
- julianwachholz 5y agoOr just use `JSON.parse(localStorage.gameState).solution` but that's not the point.
- jutaz 5y agoShameless plug: I’ve also made a solver, written in Rust. Main goal was to learn the language, 2nd the trie structure behind the search: https://github.com/jutaz/wordle-search https://github.com/jutaz/wordle-search
- juanpotato 5y agohttps://github.com/JuanPotato/Wordle-Solver https://github.com/JuanPotato/Wordle-Solver I made a similar solver, it solves all the words in 3.65 average moves. Could probably be better. The github explains how it works.
- boothby 5y agoNeat! I came up with a similar statistic (3.65 average moves, hard mode, no failures) using a very simple heuristic. 1) pick a first guess, and partition the remaining words by the hints that they give 2) given any part of a partition, pick a word that minimizes the maximum-size part of the resulting sub-partition 3) repeat (2) until words are solved. I brute-forced the first guess (that is, generated a tree rooted at each word), and the best one was 'bland'. That has one failure, getting stuck on the chain (hound, mound, pound, sound), which ended up being easy to fix manually. My tree is quite different from yours, with guess distribution 1, 103, 861, 1114, 212, 24.
- juanpotato 5y agoYeah I'm on easy mode. With hard mode on I had some failures with words that only differ by 1 letter. I was happy with the result though and didn't care to try and optimize the hardmode. I think your heuristic is pretty similar to mine, just accomplished in a different way.
- Humphrey 5y agoI have also hacked around on solving this problem. However, I decided that using the shorter list of answers was cheating, since end users wouldn't have access to this list. From a user's perspective, any word that Wordle lets you guess could be a valid solution. It's still a work in progress, but my code died when I tried to generate a complete game tree for the full list. However, in theory it could be done once, to determine the best starting word, and then hardcoded to always use the same start word. So, my plan to explore a game tree approach from guess 2.
- jeffomatic 5y agoNo slight to anyone pursuing this strategy, but I also felt like using the shorter list for ranking candidate words was cheating. On the other hand, my solver ends up making silly suggestions that might be appropriate for early on in the game, but not for late guesses. I've tried to think of what might be a good way of approximating a human's own sense of which words are viable Wordle answers. One thing I attempted was using a word frequency table to help bias the algorithm away from less common words. The funny thing is that some words rank low in word frequency but are otherwise count as "common knowledge". For example, "tapir" was a Wordle solution a few weeks ago, but it ranked lower than some obvious non-answers like "grovy". It could be that the frequency table I was using was weird, but I can believe that there are well-known words that aren't used that often. Maybe I could come up with a better corpus (e.g. only use the NYT or some other newspaper) to use as the basis for a custom frequency table. Seems like a lot of work!
- Pxtl 5y agoBut there are some obvious off-books rules. Like Wordle allows plural but the answer appears to never ever be plural.
- cortesoft 5y agoEveryone is having these really interesting conversations... but no one has explained what Wordle is :(
- quickthrower2 5y agoIts explained in the link. Go play it. its quite fun.
- tomlockwood 5y agoI added the explanation as a direct result of the comment you're responding to.
- Quentangle 5y agoWordle is a language puzzle game which has gained a lot of popularity quite quickly. The rules are very simple, yet allow for quite a lot of strategy. There are many articles about its rise to fame. The official website [1] has a single puzzle per day which everyone shares, but there are many clones which have variations, or unlimited games. [1] https://www.powerlanguage.co.uk/wordle/ https://www.powerlanguage.co.uk/wordle/
- tomlockwood 5y agoGood point! Sorry! I'll add a link to the article!
- vultour 5y agoIf you found them interesting it would take literally a single search to find out.
- davchana 5y agoYou guys are all here real programmers, but I am just good with Excel & a bit of javascript. I made this sheet to get best possible words, & I am trying to get this converted into a bookmarklet. My excel sheet is explained in this different hn thread about same game https://news.ycombinator.com/item?id=30037065 https://news.ycombinator.com/item?id=30037065 The whole word list is available in the javascript code of the game page. I know all of that can can be accessed by javascript runtime, but the javascript wordle uses is not the one I can understand, could somebody please have a look at wordle page source & let me know how can I access the variables defined in his code in js file https://www.powerlanguage.co.uk/wordle/main.e65ce0a5.js https://www.powerlanguage.co.uk/wordle/main.e65ce0a5.js in variable named La My some of the basic js apps I have made for myself are hosted on gitlab at username davchana In manual mode I try to use first word with 3 vowels & no repeat letters. Hard mode is good for not letting the tryies go waste. Thanks
- tomlockwood 5y agoHey! Don't say you aren't a real programmer! I learnt how to program in my spare time at an industrial site, using Excel! Excel runs the world, and a few years ago I got a programming contract because I had that VBA knowledge! That same company was so impressed that I eventually got a full time job with them. I am still a full time programmer to this day. So, keep working at it! Excel is real programming and javascript definitely is. For your problem though, I just copy pasted the entire list into a new file to use. If you want to use my file, its in my repo in the article under the path ./lib/words.py! You are a real programmer!!!
- davchana 5y agoHey thanks for the success story & words of encouragement.. you are the hero!! The file; I was wondering how can I access the list in my javascript bookmarklet, which I can run on his game page. I mean i can define the whole list in my own variable in my bookmarklet, but sure it is going to be over the character limit of a bookmarklet. How, when the game page is loaded, one can access that variable in console log? I tried simply typing La, but looks like it was not declared on global scope, it is a part of some object. I am thinking of using a .js file in my bookmarklet, to bypass the char limit; or adding a script link in dom; but those will be redundant data; the original var is there in runtime.
- newobj 5y agoMy manual average is 3.28. Smaller sample count than these solvers of course.
- anonu 5y agoIsn't an optimal first word one with plenty of vowels?
- ChrisLomont 5y agoI posted a similar bot and tools and analysis a while back. It solves in 3.45 moves on average, 5 or fewer moves always, and uses 5 moves less than 2% of the time. The core parts are very fast, using bitwise tricks for filtering, uses caching throughout to reduce computation, and is fully multithreaded. https://github.com/ChrisLomont/Wordle https://github.com/ChrisLomont/Wordle
- sam1r 5y agoIt’s because you’re using sets — the reason why the author mentioned things are out of order. >> A set is a collection which is unordered, unchangeable*, and unindexed. [0] [0] https://www.w3schools.com/python/python_sets.asp https://www.w3schools.com/python/python_sets.asp
- unfolding 5y agoWordle reminds of a more complex version of Mastermind[0]. Donald Knuth proved you could always solve the game in five guesses or fewer![1]. [0]: https://en.wikipedia.org/wiki/Mastermind_(board_game) https://en.wikipedia.org/wiki/Mastermind_(board_game) [1]: https://en.wikipedia.org/wiki/Mastermind_(board_game)#Best_strategies_with_four_pegs_and_six_colors https://en.wikipedia.org/wiki/Mastermind_(board_game)#Best_s...
- karmasimida 5y agoSomeone plz write a RL-agent for this game, I bet it could go lower than 3 guesses lol
- maskedinvader 5y agoI came across a post which said use the words dying, clots, brake, and whump (statistically expect worse cast 2 guess since 20/26 alphabets used in 4 guesses, worked every time for me (although with this strategy you are ending up needing 5 guesses all the time and in rare occasion need the 6th guess.
- AlexanderTheGr8 5y agoA very naive solver is giving me 3.289 guesses on average. What I did was simply sort the word_list based on frequency analysis. The guess is always the first word in the list (with the highest score) After each guess, I update the list based on the results (gray, yellow, green) For the final test, I just looped through each word in the list and played the game for that word. My algorithm got every single word (2315 words) in 7614 total guesses giving an average guess of 3.298 Right now, I am only using the list of final_words. I believe that I can get better results by using the list of attempt_words to reduce the number of possibilities, and then using final_words to give final guesses. So maybe the first 2 guesses will be using the attempt_words and then the guesses after that will be from final_words. Or maybe keep guessing from attempt_words until the list length is below a certain number and then start guessing from final_words. Something along these lines will give better results. In my freq analysis, I also accounted for the freq on each index.
- richardfey 5y agoAnyone can please fill me in on why I am seeing a daily wordle post on HN for the past week or so? Is there a competition that I missed?
- FR10 5y agoAt least in my household (and some groupchats) its become like a fun daily ritual, it takes just 5-10 minutes to play and post it, and you can only play once a day.
- shmde 5y agoWhy do people need 3 guess when the solution is literally in the localStorage /s
- normalocity 5y agoIt depends on whether you want to play the game or break it. :D Most people are taking this as a fun algorithmic exercise, assuming imperfect knowledge.
- pdanpdan 5y agoA JS version adapted from https://notfunatparties.substack.com/p/wordle-solver https://notfunatparties.substack.com/p/wordle-solver https://pdanpdan.github.io/wordle-solver/ https://pdanpdan.github.io/wordle-solver/ main code in https://github.com/pdanpdan/wordle-solver/blob/master/src/lib/wordle-solver.js https://github.com/pdanpdan/wordle-solver/blob/master/src/li...
- normalocity 5y agoTom's writeup inspired me to dig a little more. I unfortunately (for me) discovered a very simple way to solve the game on the first guess every time. My fault for reading the game's code, but I just can't look at the puzzle the same way anymore.