Hacker News new | ask | show | jobs
by ghaff 1482 days ago
>What makes a Wordle square yellow

One thing I had wondered--but not enough to figure out what the code does...

Let's say you enter Mamma for example. And there is one M in the word but in the second position. Which M square does Wordle choose to turn yellow? (But maybe it doesn't matter?) There may be other cases like that as well.

4 comments

Here’s the algorithm of the game’s letter marking system, based on my experience reproducing its logic for a script I wrote that computes remaining words from your guesses and their corresponding marks.

Suppose the target word is “polar” and you guess “banal”.

A submitted word is marked in 3 passes.

0. Initial state: (“banal”, “polar”)

1. Zip together the letters of the guess and target words, and loop through the zipped list. When both letters at a position are the same, replace the guess letter with the symbol for “correct” (green) and remove the target letter from the target word. State: (“banGl”, “polr”)

2. Loop through the target word’s letters, replacing the first occurrence (if any) of each one in the guess word with the symbol for “present” (yellow). State: (“banGY”, “polr”)

3. Replace any remaining letters in the guess word with the symbol for “not present” (black). State: (“BBBGY”, “polr”)

Return the marked guess word.

---

Other examples:

0. (“mamma”, “amaze”)

1. (“mamma”, “amaze”)

2. (“YYmmY”, “amaze”)

3. (“YYBBY”, “amaze”)

---

0. (“nieto”, “otoño”)

1. (“nietG”, “otoñ”)

2. (“nieYG”, “otoñ”)

3. (“BBBYG”, “otoñ”)

edit: fixing formatting issues. Sorry, first time posting a comment on here.

For yellow squares, the particular order in which they turn yellow doesn't matter.

The remaining grey Ms tell you the same thing (that those positions don't have an M).

That's true for Wordle, but I think according to the dontwordle rules you are allowed to make a guess with an em on one of the grey squares anyway.
No you are not allowed to do that. A grey square excludes the letter from the position, regardless of any yellow squares.
You are correct. Words with repeated letters are not a good strategy in this game.
Words with repeated letters are a great strategy, as long as you know or strongly suspect the letter isn't in the target word, and the letter is rare so eliminating it doesn't eliminate much.
They are a fantastic strategy, though if one happens to rob you of a lot of remaining words, you should undo it.
Hmm, that was the case when I tried and I jumped to the conclusion
I'm not sure about your conclusion here. If we don't repeat the letter then we're going to have information about another letter, which we don't want.
> Let's say you enter Mamma for example. And there is one M in the word but in the second position. Which M square does Wordle choose to turn yellow? (But maybe it doesn't matter?)

I don’t think it matters, it should just default to the first M.

From experience, the first M.
Yep, it's the first M.

I think in general the rule is this: - Any Ms in the correct position turn green (duh) - If there are X Ms remaining in the answer, turn the first X (non-green) Ms in the guess yellow