Hacker News new | ask | show | jobs
by nilsbunger 1625 days ago
I figured that was possible; from the UX it was pretty clear it’s all client side.

What I would find cool is derivation of the best strategy at any time. Just like blackjack, there should be a “best” move at all times , and it would be cool to measure yourself against that

3 comments

I haven't implemented the best strategy at _all_ times, but this blog post[0] proposes a strategy (pick the word that minimizes the expected-size of the resultant set of possible answers). I made a User Script[1] that tells you how many words remain after each guess - it shouldn't be too hard to expand that to tell you a) what the expected answer-set-size was with your answer, and b) how that compares with the "best" answer.

[0] https://blog.scubbo.org/posts/cheating-at-word-games/ [1] https://blog.scubbo.org/posts/cheating-at-word-games-part-3/

I made one, not the optimal strategy though, I simply minimized the expected number of possible solutions for the next step. I repurposed my Mastermind solver since it's basically the same game. Just like Mastermind, minimax is probably better than what I did, but it does solve every Wordle in at most 5 guesses, on average 3.4 guesses.

https://github.com/jbchouinard/untitled-word-game

https://en.wikipedia.org/wiki/Mastermind_(board_game)#Best_s...

>it's basically the same game //

Surely it differs from Mastermind (which I might not be remembering well as I didn't like it) in that the answers must be words in the game's dictionary rather than arbitrary colour codes? That seems to change tactics considerably.

I agree it changes the experience of playing the game for a human quite a bit, and you'll use different tactics, but for the kind of solver I made it doesn't change much - I had to change very little code to make it work.

From the perspective of the solver it just means the starting set of potential solutions is every word in the dictionary, instead of every permutation, but it doesn't really make much of a structural difference. Either way a solver can just brute-force its way through every potential solution since there aren't that many.

The other difference is that Mastermind tells you only how many of the pegs are correct, but not which ones. Wordle tells you which ones. That is easier, but it's counterbalanced by Wordle having a larger solution space. There's only 1296 possible solutions for classic Mastermind (4 pegs, 6 colors).

I think using the expected logarithm of the number of solutions (entropy) makes more sense from an information theory perspective. I wonder if it works better in practice.
I think there’s been a few of those on hacker news. Let me dig one up
There is this one (from myself) : https://remy.grunblatt.org/static/wordle/wordle.svg (dynamic version: https://remy.grunblatt.org/static/wordle/).

It's not optimal at all, but works for every wordle word; it's built by finding the word (guess) that minimizes the maximum size of the possible words (to guess), a bit like Knuth Algorithm for Mastermind.

For an optimal strategy, a backtracking solution with pruning / maybe a branch and bound approach would work, but I didn't manage to implement a fast enough implementation for my small 8 threads CPU.