Spaces:
Running
Running
Ctrl+K
import random inventory = [] health = 10 print("You enter a spooky cave with two tunnels.") choice1 = input("Go 'left' or 'right'? ").lower() # LEFT PATH - find a key if choice1 == "left": print("You find a glowing key! π") inventory.append("key") print("You return to the entrance.\n") choice1 = input("Now go 'right': ").lower() # RIGHT PATH - face a monster if choice1 == "right": print("A wild cave monster appears! πΉ") while health > 0: action = input("Do you 'fight' or 'run'? ").lower() if action == "fight": hit = random.randint(1, 5) print(f"You hit the monster for {hit} damage!") if hit >= 3: print("You scare the monster away! π±") break else: damage = random.randint(1, 3) health -= damage print(f"The monster hits back! You lose {damage} health. β€οΈ {health} left.") elif action == "run": print("You escaped, but dropped your key! π’") inventory.clear() break else: print("Invalid action!") if health <= 0: print("You were defeated. π Game Over.") elif "key" in inventory: print("You find a locked treasure door. You use your key... π") print("You found the hidden treasure! π YOU WIN!") else: print("You find the treasure room, but it's locked. πͺ You don't have the key.") else: print("You wandered into darkness and got lost. π΅") - Initial Deployment
308c02c verified