Word Bomb Script Online
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")
def is_valid_word(word, required_letters): """Check if word contains the required letters as a substring.""" return required_letters.lower() in word.lower() Word Bomb Script
================================================== 💣 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... You must say a word containing the given letters
print(f"✅ Correct! '{user_word}' contains '{required_letters}'.") print(f"🔪 Bomb defused! Passing to next player...") 👉 Your word: zebra ✅ Correct
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
def get_random_letters(): """Return a string of 2-3 random letters (e.g., 'ap', 'cat').""" length = random.choice([2, 3]) letters = ''.join(random.choices('abcdefghijklmnopqrstuvwxyz', k=length)) return letters
if user_word == 'quit': print("Game ended.") break