Live data from Hacker News

Solving Wordle in 3.64 guesses on average, 99.4% of the time

lockwood.dev

101–110 of 181 posts

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#101
post #38

>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.

As 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 pro…

A 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.

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#102

Earlier quoted context omitted.

I've seen a number of solvers; but my partner has forbidden me from writing one, forcing me to do everything in wetware. 3-4 guesses seems right intuitively. I saw some speculation that the dictionary was well-known, is that true? Seems to me that the problem as-stated allows the guesser to discover a nonword "for free", but otherwise expects the dictionary to be "all five letter words" which is much larger than the…

This program actually inadvertently created a quite philosophical discussion amongst my friends! Some of them contended that writing a program to solve wordle sucked the joy out of the process of solving it, even if I solved the puzzle myself, first.

Yes it's interesting, precisely because it's intuitively "solvable" by machines. There's joy in solving by hand, and joy in creating a solver, but probably no joy in running your solver every day and sharing with your friends. Because every decision is some maximum-likelihood estimate, there's no tension or drama in the sequence of guesses.

In fact, simply the act of creating an infallible solver (100% likelihood of 6 guesses or less) demonstrates the futility of competing with their soft, fleshy skills.

I do think any solver that uses the solution-set is "cheating", but I suspect it makes little difference in the total solution (like... 2-3 bits of additional information needed, just a fraction of a round).

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#103
post #44

Going 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-analys...

That's exactly my approach. I wrote a very simple O(N^3) algorithm to determine that: for each possible actual word and the guessed word, figure out whether or not a word is eliminated. Then calculate a score based on how many words can be eliminated from a particular guessed word, averaged over all possible actual words. (I originally thought O(N^3) would be way too slow to be useful. But it runs fast enough with a…

FWIW, your O(N^3) algorithm can be equivalently implemented in O(N^2) by using the following observation: a word is not eliminated by a guess if and only if the result of testing the word against the solution is the same as the result of testing the guess against the solution. Using this, you can implement the algorithm like so: for a given solution, partition all of the guesses based on the result of testing them against that solution. This partitioning takes O(N). Then, the set of words that will be left over from a guess is equal to all the words in the same partition as the guess. This makes it easy to calculate "how many words can be eliminated from a particular guessed word".

I'm making this comment because I started with the same O(N^3) approach and then realized this. :)

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#104
post #22

As 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.

I 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.

For the creator of Wordle and their partner, who obviously have some love of word puzzles, REBUS (a picture to word puzzle) would be a familiar word.

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#105

Everyone is having these really interesting conversations... but no one has explained what Wordle is :(

Wordle 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/

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#106
post #80
post #74

Earlier quoted context omitted.

This is great. But it seems to fail with words containing repeat letters, for example, with my word as BOOKS, not on hard mode: SOARE JUMBY BOOST (at this point, it claimed to have won!)

books isn't a valid solution. it's on the guesslist but not the wordlist.

Correct. In fact, thousands of plural words are allowed as guesses, but the solution will never be plural. Source: I grep'd the lists of solutions and authorized guesses.

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#107

You 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 The whole word list is available in the javascript code of the game page. I know all of that can can be acc…

Hey! 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!!!

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#109

You 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 The whole word list is available in the javascript code of the game page. I know all of that can can be acc…

Hey! 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 javascri…

Hey 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.

Re: Solving Wordle in 3.64 guesses on average, 99.4% of the time

#110

I 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, t…

But there are some obvious off-books rules. Like Wordle allows plural but the answer appears to never ever be plural.
Post reply on HN