Open Source Adventures: Episode 13: What if Wordle was Evil
Tags: wordle, games
Published: 2022-03-08 18:16:57

Everybody knows Wordle. There's also a bunch of spin-offs like [Worldle](https://worldle.teuteuf.fr/), [Lewdle](https://www.lewdlegame.com/), and so on.

Anyway, I had an idea, what if Wordle was totally evil, and tried to make things as difficult as possible for you, basically cheating in an undetectable way.

### Wordlists

Wordle has two word lists, 2315 main list from which it picks a word, and additional list of 10656 difficult words you can use for your guesses, but Wordle won't use.

The obvious idea is that we could pick challenges from the whole set, but then we have completely fake words like "zoaea", "zooea", "zoeae" and so on, and people would not be happy with that.

Many of the words on the extra list like "argon", "arses", or "asked" are perfectly fine, but I really don't want to go through it manually.

Let me know if you know of any better lists of 5-letter words.

### Normal Wordle

Anyway, normal Wordle works like this:

* Wordle secretly picks a word
* you guess, Wordle tells you how well you did
* eventually you get a perfect guess and win

But what if it didn't actually pick a word, only pretended to...

### Evil Wordle Idea

Let's try this fake session:

```
(There are 2315 possible words that match what happened so far)
Guess: crane
Wordle: 🟥🟥🟥🟥🟥

(There are 263 possible words that match what happened so far)
Guess: study
Wordle: 🟥🟨🟥🟥🟥

(There are 20 possible words that match what happened so far)
Guess: light
Wordle: 🟥🟩🟩🟩🟩

(There are 4 possible words that match what happened so far)
Guess: fight
Wordle: 🟥🟩🟩🟩🟩

(There are 3 possible words that match what happened so far)
Guess: tight
Wordle: 🟥🟩🟩🟩🟩

(There are 2 possible words that match what happened so far)
Guess: might
Wordle: 🟥🟩🟩🟩🟩

(There is only 1 possible word that match what happened so far)
Guess: wight
Wordle: 🟩🟩🟩🟩🟩
```

This session might have happened because you were just really unlucky. Maybe Wordle just so happened to pick "wight".

But what we want is for Evil Wordle to keep its options open, and only pick a word when it has no choice.

### Evil Wordle Algorithm

It's not really clear what would be the best Evil Wordle Algorithm. The easiest one is to pick a word, but if player is about to score 🟩🟩🟩🟩🟩, then it could go back and see if it could change the word without making any of its previous answers incorrect. So for example the word was actually "fight", but when the player got to it, Evil Wordle checked which other word it could substitute for it, and changed it to "might", and then again to "wight". But that's not likely to do much.

A stronger algorithm could try to reveal the least information. That's not the same as going for as many misses as possible. For example this would be worse for Evil Wordle, that yellow t doubles number of possibilities:

```
(There are 2315 possible words that match what happened so far)
Guess: crane
Wordle: 🟥🟥🟥🟥🟥

(There are 263 possible words that match what happened so far)
Guess: study
Wordle: 🟥🟥🟥🟥🟥

(There are 10 possible words that match what happened so far)
Guess: limbo
Wordle: 🟨🟨🟥🟥🟩

(There are 2 possible words that match what happened so far)
Guess: igloo
Wordle: 🟨🟥🟩🟨🟩

(There is only 1 possible word that match what happened so far)
Guess: folio
Wordle: 🟩🟩🟩🟩🟩
```

Intuitively giving an answer that keeps as many words as possible still open looks like the best approach, but that suffers from being fully deterministic, and some sets of possibilities are much worse than others. For example light/might/night/fight/wight/tight might be really hard to disentangle, while bigger set of completely different words could be guessed really easily.

Maybe there's some way to implement evilness meter, to estimate how many guesses you'd need with a perfect play against different algorithms.

### Story so far

[All the episode code is in this repo](https://github.com/taw/open-source-adventures).

For this one it's just 2 Wordle lists, and a script for quickly Wordling everything in STDIN, which I used to fake Evil Wordle sessions with some grepping.

### Coming next

In the next episode I'll try to implement some Evil Wordle algorithm. This way I'll be able to tell if that's actually interesting and worth setting up a website for, or just a missed idea.