Word Bomb Script | 2026 |
# Get player's answer start_time = time.time() user_word = input("๐ Your word: ").strip().lower() elapsed = time.time() - start_time
if user_word == 'quit': print("Game ended.") break
# Start bomb timer timer = threading.Thread(target=bomb_timer, args=(5, current_player)) timer.daemon = True timer.start()
================================================== ๐ฃ Alex's turn! Bomb is ticking... ๐ค Required letters: AP โฑ๏ธ You have 5 seconds! ๐ Your word: apple โ Correct! 'apple' contains 'ap'. ๐ช Bomb defused! Passing to next player... Word Bomb Script
def is_valid_word(word, required_letters): """Check if word contains the required letters as a substring.""" return required_letters.lower() in word.lower()
================================================== ๐ฃ 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...
player1 = input("Player 1 name: ").strip() or "Player 1" player2 = input("Player 2 name: ").strip() or "Player 2" players = [player1, player2] current_player_idx = 0 GAME LOOP ------------------------------ while True: required_letters = get_random_letters() current_player = players[current_player_idx] # Get player's answer start_time = time
# If bomb hasn't exploded yet, cancel by not calling exit (thread is still alive, but we'll just not let it affect) # Better: just check if time's up if elapsed > 5: print(f"\n๐ฃ BOOM! Too slow, {current_player}!") print(f"Required letters were: {required_letters}") break
You can copy this script into a Python environment or run it in any terminal. import random import time import threading ------------------------------ WORD LIST (sample; expand as needed) ------------------------------ WORD_LIST = [ "apple", "application", "apricot", "banana", "basketball", "cat", "catalog", "dog", "dragon", "elephant", "fantastic", "grape", "happy", "internet", "jazz", "kangaroo", "lamp", "mountain", "notebook", "octopus", "python", "quick", "rainbow", "sunshine", "tiger", "umbrella", "victory", "window", "xylophone", "yellow", "zebra" ]
print(f"โ Correct! '{user_word}' contains '{required_letters}'.") print(f"๐ช Bomb defused! Passing to next player...") ๐ Your word: apple โ Correct
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")
print("\n" + "="*50) print(f"๐ฃ {current_player}'s turn! Bomb is ticking...") print(f"๐ค Required letters: {required_letters.upper()}") print("โฑ๏ธ You have 5 seconds!")
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 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