diff options
Diffstat (limited to 'bot/exts/fun/hangman.py')
-rw-r--r-- | bot/exts/fun/hangman.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/bot/exts/fun/hangman.py b/bot/exts/fun/hangman.py index f385a955..7a02a552 100644 --- a/bot/exts/fun/hangman.py +++ b/bot/exts/fun/hangman.py @@ -89,7 +89,7 @@ class Hangman(commands.Cog): word = choice(filtered_words) # `pretty_word` is used for comparing the indices where the guess of the user is similar to the word # The `user_guess` variable is prettified by adding spaces between every dash, and so is the `pretty_word` - pretty_word = ''.join([f"{letter} " for letter in word])[:-1] + pretty_word = "".join([f"{letter} " for letter in word])[:-1] user_guess = ("_ " * len(word))[:-1] tries = 6 guessed_letters = set() @@ -104,7 +104,7 @@ class Hangman(commands.Cog): )) # Game loop - while user_guess.replace(' ', '') != word: + while user_guess.replace(" ", "") != word: # Edit the message to the current state of the game await original_message.edit(embed=self.create_embed(tries, user_guess)) @@ -136,7 +136,7 @@ class Hangman(commands.Cog): continue # Checks for repeated guesses - elif normalized_content in guessed_letters: + if normalized_content in guessed_letters: already_guessed_embed = Embed( title=choice(NEGATIVE_REPLIES), description=f"You have already guessed `{normalized_content}`, try again!", @@ -146,12 +146,11 @@ class Hangman(commands.Cog): continue # Checks for correct guesses from the user - elif normalized_content in word: + if normalized_content in word: positions = {idx for idx, letter in enumerate(pretty_word) if letter == normalized_content} user_guess = "".join( [normalized_content if index in positions else dash for index, dash in enumerate(user_guess)] ) - else: tries -= 1 |