Looking at the source, this doesn't handle ambering of repeated letters correctly:
let mut diff = [Match::Black; 5];
for (i, &b) in input.iter().enumerate() {
if solution[i] == b {
diff[i] = Match::Green;
} else if solution.contains(&b) {
diff[i] = Match::Amber;
}
}
If the solution is "crest", for example, guessing "class" should give green for the first s and black/grey for the second s, but your implementation will give amber for the second s. And if you guess "stars", then only the first s should be amber, and the second should be black.
It's interesting to me how common this bug with the coloring of repeated letters in guesses is in Wordle clones, as well as how often there are disagreements in comments about what the correct behavior should be.
IMO, this is something that ought to be called out in a hypothetical formal specification of Wordle, but I kind of like that it isn't mentioned in the instructions for the game, from a gameplay/learning perspective. It encourages people to reason through what the correct behavior ought to be on their own, and to experiment to see how the implementation marks guesses; the assumption that letters can't be repeated is one that a lot of people don't realize that they're making.
It is unnecessarily harsh, but the behavior is also important if the answer contains a letter once but your guess contains it twice, not only if the answer contains it twice.
The problem also happens if the answer contains the letter once, but the guess contains it twice. Imagine the middle letter in the answer is an E, no other E anywhere. I guess EXXXE (assuming that's a word). Both E are yellow: that's incorrect. There's 1 misplaced E and one superfluous E. Which is which is arbitrary. In the version of the game I made from my discord bot, I go left to right, so the E on the left would be yellow, the one on the right would be grey.
You may not have needed that information, but if the game marks both instances of the same letter as amber (correct letter, wrong place), but there is only one instance then it has misled the player. That's incorrect behavior. The player should be able to discern from their guess which letters and how many of them there are in the solution. They shouldn't be led towards a wrong answer.
It's not a stellar plan, but if someone starts off with a guess like "abyss" and there is only one 's', they shouldn't be tricked by the game.
Not to mention, if you play on hard mode, using that non-existent second 's' is now required. I get that this implementation doesn't have a hard mode, but most of my friends play in hard mode, in practice, even if the box isn't ticked on.
But that's the thing, you can't "play it just fine". You can play a broken version of the game. Nobody is interested in a game that is 90% correct.
And then on top of that you're being defensive when you receive very valid feedback instead of gladly accepting it. What's the point of even posting to HN if you're not welcoming feedback?
You come off as somewhat defensive, dismissive, uncaring. Which are normal and justifiable human emotions when someone is criticizing your creations. But "the crowd" really doesn't like to see them expressed. So it's a good rule of thumb when posting these things in public to err on the side of being gracious and grateful. Like it or not, it's just good PR.
I agree in a sense, but I was initially responding to someone who said the game was "useless" without this, which in my experience is just not true and rude itself (and most people I know don't understand the rules of how it handles doubles)
The "didn't care" part was referring to my initial research, and not the fix. In my top level comment, I mentioned this was a quick couple hour project.
I didn't mind the initial criticism. Like I said before, I found it interesting.
I think that's all true, but also doesn't contradict anything I said in my original comment unfortunately. You have good reasons for saying/doing these things, but the impression you give off is still the impression you give off. If you want it to be a good impression, the trick is to ignore slightly rude comments, avoid mentioning that you "didn't care" initially, avoid talking about how little effort you put into the project, etc. People are going to (correctly?) assume this is defensiveness.
It's like implementing a chess game except your knight moves 1 square forward + 1 square to the side instead of 1+2. Sure, you can play it, but the game is wrong.
Which makes it not chess; i.e. not fit for purpose. And this omission is more on the scale of missing castling than en passant. Some people who futz with two or so moves will think it's "fine" but it's missing something critical.
Funny that you mention castling. Most of chess rules were consolidated back in 1500s with barely nothing needing change since. Still, every now and then some absurdity ensues leading to rules change, like the time when FIDE was forced to review the wordings on castle:
Question: Did people not use to play chess before 1972? If every tiny incompatibility with the specs make the game different, then surely people before 1972 were playing a different game? And that's just chess, pretty much every major games see changes in their ruleset practically every year.
You are obviously going to say chess is whatever the rule is in _current year_, sidestepping that philosophical examination. I don't want to get into that either when the bigger problem is in the claim that any deviation makes it "not fit for purpose". If the purpose of a game is to conform perfectly to a spec defined by someone else, then everyone playing football for fun with makeshift goal posts everyday in the field near my house mustn't have gotten the memo.
Exactly how jaded must programmers be from having to follow client's specification all the time to have this outlook?
I would think the neighborhood kids playing football know they aren't playing on a regulation field. If you change the wordle rules and tell somebody it's wordle, do they know the rules have changed?
The kids go back and tell everyone they had been playing football, indeed knowing they weren't playing on a regulation field. And no one in the world has a problem with them calling it football, again despite knowing they weren't playing on a regulation field.
Fascinating how the perceived tone of the initial response can change the outcome of the deepest thread. Sensitive dependence on initial conditions. Human conversation meets James Gleick’s Chaos conditions!
There's nothing even wrong with the initial response. On the contrary, "Fair enough" and "I might patch it later" led to "the game is basically useless" and "You come off as somewhat defensive, dismissive, uncaring". I think some people just had their cereal pissed-in this morning and/or need to look in the mirror.