Discuss Scratch

costlycoyote
Scratcher
45 posts

Wordle Game Multiple Letter Bug

before you read this, this will be much easier to understand if you understand the rules of wordle. :)


Hey, so I am trying to recreate wordle, but have stumbled across a bug. So let's say that the secret word was south, and you guessed sissy, For example. the first letter would be marked as green, but the two s's in the middle of the word would be marked as yellow, because the word contains those two letters, even though there is only one s. Right now I am using a list which tracks each individual letter of the guess, where it then joins them together to form a variable which is your “guess”. I then have a list which I called score. then I have a series of if else statements that track if letter 1 of the secret word = letter 1 of the guess, replace item 1 of the score list with green. else, if secret word contains letter 1 of guess replace item 1 of score with yellow, else replace item 1 of score with grey. Which then continues through all 5 letters, then sends the data from the score list to the tiles, which then change their costume to each corresponding item in the score list. Sorry for the long and confusing question, I just need some help. I will link an unfinished version of the project down below, which is shared on my test account. Thank you for your time. Have a great day and God bless. <3


https://scratch.mit.edu/projects/855770229 <———- link to the unfinished project
snezitko
Scratcher
100+ posts

Wordle Game Multiple Letter Bug

Something like:
whenclickedforeverifpossiblegreen>orangethendontturnintoorange
costlycoyote
Scratcher
45 posts

Wordle Game Multiple Letter Bug

hmmmm. I'm not quite sure what orange means
snezitko
Scratcher
100+ posts

Wordle Game Multiple Letter Bug

yellow
costlycoyote
Scratcher
45 posts

Wordle Game Multiple Letter Bug

okay, that makes sense. But what do you mean by (also, thank you so much for helping )


possiblegreen>yellow
legendary34678
Scratcher
1000+ posts

Wordle Game Multiple Letter Bug

Try something like this:

1. First, turn the actual word and the guessed word into lists.

   Actual Guess
1. C C
2. H H
3. E E
4. S E
5. S K

2. Then, loop through Guess and count how many letters in Guess matched Actual (green). When they match each other, remove both letters from the list. After this check, the lists should look like this:

   Actual Guess
1. S E
2. S K

We can add the checked letters to a list so we know which letters to turn green. In this case, C, H, and E will be green.

3. Afterwards, loop through the list again. This time, simply check whether the letter in Guess is anywhere in Actual (yellow). If Actual contains the letter from Guess, remove both letters. For example, you loop through Guess and land on S. Actual also contains S. So, you remove S from Guess and S from Actual.

We can add the checked letters to another list so we know which letters to turn yellow. In this case, none of the letters will be yellow.

4. The remaining letters will be gray.

5. Finally, when changing the colors of the letters in Guess, you will first check the green, then the yellow, then the gray lists to see if each list contains the letter. If green contains the letter in Guess, you will change the color of the letter and then delete that letter from the green list to avoid duplicates.

Hope the above explanation wasn't too confusing. Below is the code implementation of what I suggested:

definecheckforgreensetito1repeatlengthofGuessifitemiofGuess=itemiofActualthenadditemiofGuesstoGreendeleteiofGuessWe don't increment i because deleting the lettersdeleteiofActualfrom Guess and Actual has the same effect.elsechangeiby1definecheckforyellowsetito1repeatlengthofGuessifActualcontainsitemiofGuess?thenadditemiofGuesstoYellowdeleteitem#ofitemiofGuessinActualofActualdeleteiofGuessDon't increment i for same reasons as above.elsechangeiby1Before calling the function below, add all of the letters back into Guessdefineaddcolorssetito1repeat5ifGreencontainsitemiofGuess?then. . .Color letter greendeleteitem#ofitemiofGuessofGreenofGreenelseifYellowcontainsitemiofGuess?then. . .Color letter yellowdeleteitem#ofitemiofGuessofYellowofYellowelse. . .Color letter graychangeiby1
09878901234321
Scratcher
500+ posts

Wordle Game Multiple Letter Bug

I made a Wordle game on my alt account, feel free to look at it.

https://scratch.mit.edu/projects/843087946/
FuzyBee1234
Scratcher
10 posts

Wordle Game Multiple Letter Bug

Hi im making a wordle game , So far I have got to when you type in a word it makes a sound if its valid word or not valid word. But when I type a real word like “hello” onto the last line it will set entered word to HELLdefaultO (default is the name of the costume for nothing). heres a link to my project please comment if you can fix it
https://scratch.mit.edu/projects/964282535

If you can Thanks!!
NotK3ndricAlt
Scratcher
1000+ posts

Wordle Game Multiple Letter Bug

FuzyBee1234 wrote:

Hi im making a wordle game , So far I have got to when you type in a word it makes a sound if its valid word or not valid word. But when I type a real word like “hello” onto the last line it will set entered word to HELLdefaultO (default is the name of the costume for nothing). heres a link to my project please comment if you can fix it
https://scratch.mit.edu/projects/964282535

If you can Thanks!!
Please don’t necropost.
Also, the above might help.

Powered by DjangoBB