Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

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.



There 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.


Why not Ffederasiwn Rhyngwladol Wordle given the original programmer is Welsh?


FIWA (Fédération Internationale de Wordle Association)


Association Wordle? What's next, Aussie rules?


But seriously, shouldn't the original Wordle be treated as the reference implementation?


It 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.


I 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.


I 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 )


Yes I just noticed that issue too, still trying to figure out how to fix it :P


I think I just fixed the problem now. And it's still 50 lines :D


If 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/27d208248b7a...


Here 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.


I just used this fix, and it worked!!!! Thank you so much!!!


I can feel a round of golf coming on :)


Here's my straight javascript version https://github.com/rrmm/mastermind-word . But it isn't particularly source length efficient.


Please let us know when that is fixed and I’ll play this for sure!


That 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).


I believe op was saying that the linked reimplementation incorrectly misses the behavior that you are describing.


Bummer. 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: