Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions games/Hangman-Game/Hangman-Game.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,65 @@

from utils.banners import print_victory_banner, print_game_over_banner

HANGMAN_STAGES = [
"""
-----
| |
|
|
|
|
""",
"""
-----
| |
| O
|
|
|
""",
"""
-----
| |
| O
| |
|
|
""",
"""
-----
| |
| O
| /|
|
|
""",
"""
-----
| |
| O
| /|\\
|
|
""",
"""
-----
| |
| O
| /|\\
| /
|
""",
"""
-----
| |
| O
| /|\\
| / \\
|
""",
]

def main():
# Cleaned up global variables (not strictly necessary unless modifying in nested scopes, but kept for your structure)
global all_guessed, attempts, correct_letters, display, guess, guessed_letters, hint, letter, max_attempts, selected, won, word, word_data, word_length
Expand Down Expand Up @@ -108,6 +167,7 @@ def main():
else:
display += "_ "

print(HANGMAN_STAGES[attempts])
print(f"Word: {display}")

# 2. CHECK WIN CONDITION HERE BEFORE ASKING FOR A NEW GUESS
Expand Down
Loading