def bomb_timer(seconds, player_name): """Timer thread that waits and then explodes.""" time.sleep(seconds) print(f"\nš£ BOOM! {player_name} took too long! š£") print(f"Required letters were: {required_letters}") exit(0) GAME SETUP ------------------------------ print("\nš„š„š„ WORD BOMB š„š„š„") print("Players take turns. You must say a word containing the given letters.") print("You have 5 seconds before the bomb explodes!") print("Type 'quit' to exit.\n")
# Get player's answer start_time = time.time() user_word = input("š Your word: ").strip().lower() elapsed = time.time() - start_time Word Bomb Script
print("\n" + "="*50) print(f"š£ {current_player}'s turn! Bomb is ticking...") print(f"š¤ Required letters: {required_letters.upper()}") print("ā±ļø You have 5 seconds!") You must say a word containing the given letters
================================================== š£ Jamie's turn! Bomb is ticking... š¤ Required letters: ZE ā±ļø You have 5 seconds! š Your word: zebra ā Correct! 'zebra' contains 'ze'. šŖ Bomb defused! Passing to next player... š¤ Required letters: ZE ā±ļø You have 5 seconds
if not is_valid_word(user_word, required_letters): print(f"\nā WRONG! '{user_word}' does not contain '{required_letters}'.") print(f"{current_player} loses!") break