4 ms·
This doesn't handle Yellow result correctly. Specifically, if there is a repeated letter in the guess but that letter appears once in the actual word, then the
by kccqzy 5y ago
This doesn't handle Yellow result correctly. Specifically, if there is a repeated letter in the guess but that letter appears once in the actual word, then the second occurrence will get a Black instead of a Yellow.
In other words, a Yellow result doesn't just mean that letter occurs somewhere. A Black also doesn't mean the letter occurs nowhere.
- huydotnet 5y agoYes I just noticed that issue too, still trying to figure out how to fix it :P
- indigodaddy 5y agoPlease let us know when that is fixed and I’ll play this for sure!
- kccqzy 5y agoIf you don't mind a shameless plug, I made this same mistake before and here's how I fixed it: https://github.com/kccqzy/Wordle-Assistant/blob/27d208248b7a1cc63de2773b072bcfa42266e7bc/src/main.rs#L220-L257 https://github.com/kccqzy/Wordle-Assistant/blob/27d208248b7a...
- hddqsb 5y agoHere is one way to fix it (but it will push you over 50 lines!) remaining="" output="" for ((i = 0; i < ${#actual}; i++)); do if [[ "${actual:$i:1}" != "${guess:$i:1}" ]]; then remaining+=${actual:$i:1} fi done for ((i = 0; i < ${#actual}; i++)); do if [[ "${actual:$i:1}" != "${guess:$i:1}" ]]; then if [[ "$remaining" == *"${guess:$i:1}"* ]]; then output+="\033[30;103m ${guess:$i:1} \033[0m" remaining=${remaining/"${guess:$i:1}"/} else output+="\033[30;107m ${guess:$i:1} \033[0m" fi else output+="\033[30;102m ${guess:$i:1} \033[0m" fi done printf "$output\n" Explanation: The variable `remaining` tracks the letters of `actual` that can contribute toward yellows.
- huydotnet 5y agoI think I just fixed the problem now. And it's still 50 lines :D
- rrmm 5y agoHere's my straight javascript version https://github.com/rrmm/mastermind-word https://github.com/rrmm/mastermind-word . But it isn't particularly source length efficient.
- sackerhews 5y agoBummer. He should have used microservices. Then the problem at least would have been isolated to that part and the rest of the system in 100% good shape.
- gp2000 5y agoThat isn't a bug. In the original if a guess contains a repeated letter and there is only one occurrence of that letter in the target work then the first (on the left) letter will be yellow and the second black. You can see this with today's word by guessing MOTTO. The leftmost T will be yellow and the rightmost will be black. Similarly, if you guess TENET the initial T is black but the final T is green. Today's word is ZBVFG (rot13).
- esrauch 5y agoI believe op was saying that the linked reimplementation incorrectly misses the behavior that you are describing.
- tragomaskhalos 5y agoThere seems to be a lot of confusion and different opinions around how repeated letters should be treated; we really need FIDW (Fédération Internationale de Wordle) to make a definitive ruling.
- pqs 5y agoFIWA (Fédération Internationale de Wordle Association)
- tomjakubowski 5y agoAssociation Wordle? What's next, Aussie rules?
- 6LLvveMx2koXfwn 5y agoWhy not Ffederasiwn Rhyngwladol Wordle given the original programmer is Welsh?
- ZetaZero 5y agoBut seriously, shouldn't the original Wordle be treated as the reference implementation?
- jeroenhd 5y agoIt depends on how you look at it. Wordle is just an online implementation of the game "Lingo", after all. You could argue that Lingo is a letter implementation of Mastermind. When building a new word grid game, would you take Wordfeud's rules over Scravble's? I don't think I would.
- ZetaZero 5y agoI see your point. But calling it a "Wordle clone" implies it follows the same rules. If you want to change the rules, call it "inspired by Wordle" or something similar.
- pheasantquiff 5y agoI used to have exactly this bug in my revolt Wordle chatbot. It's especially annoying when one of the duplicates is in the correct position but get's marked as BLACK since a previous repeat has been marked YELLOW. (I don't think this can be classed as correct behavior) ( My revolt Wordle server: https://app.revolt.chat/invite/2q3NYtM9 https://app.revolt.chat/invite/2q3NYtM9 )