You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whatever be the guess, the letters do not get substituted, it always stays gray.
My code snippet is:
`def generate_colored_words(guess: str, answer: str) -> str:
"""Return string of emojis with the letter colored"""
colored_word = [EMOJI_CODES["grey"][letter] for letter in guess]
answer_letters = list(answer)
guess_letters = list(guess)
#change letter to green if same letter and same place
for i in range(len(guess_letters)):
if guess_letters[i] == answer_letters[i]:
colored_word[i] == EMOJI_CODES["green"][guess_letters[i]]
answer_letters[i] = None
guess_letters[i] = None
#change letter to yellow if same letter and different place
for i in range(len(guess_letters)):
if guess_letters[i] is not None and guess_letters[i] in answer_letters:
colored_word[i] == EMOJI_CODES["yellow"][guess_letters[i]]
answer_letters[answer_letters.index(guess_letters[i])] = None
return "".join(colored_word)
Whatever be the guess, the letters do not get substituted, it always stays gray.
My code snippet is:
`def generate_colored_words(guess: str, answer: str) -> str:
"""Return string of emojis with the letter colored"""
colored_word = [EMOJI_CODES["grey"][letter] for letter in guess]
answer_letters = list(answer)
guess_letters = list(guess)
#change letter to green if same letter and same place
for i in range(len(guess_letters)):
if guess_letters[i] == answer_letters[i]:
colored_word[i] == EMOJI_CODES["green"][guess_letters[i]]
answer_letters[i] = None
guess_letters[i] = None
#change letter to yellow if same letter and different place
for i in range(len(guess_letters)):
if guess_letters[i] is not None and guess_letters[i] in answer_letters:
colored_word[i] == EMOJI_CODES["yellow"][guess_letters[i]]
answer_letters[answer_letters.index(guess_letters[i])] = None
return "".join(colored_word)
def update_embed(embed: nextcord.Embed, guess : str):
puzzle_id = int(embed.footer.text.split()[1])
answer = popular_words[puzzle_id]
colored_word = generate_colored_words(guess, answer)
empty_slot = generate_blanks()
embed.description = embed.description.replace(empty_slot, colored_word, 1)
return embed
`
The text was updated successfully, but these errors were encountered: