|
| 1 | +import time |
| 2 | + |
| 3 | +def print_delay(text, delay=1): |
| 4 | + print(text) |
| 5 | + time.sleep(delay) |
| 6 | + |
| 7 | +def intro(): |
| 8 | + print_delay("You wake up in a dark, mysterious room.") |
| 9 | + print_delay("You can't remember how you got here.") |
| 10 | + print_delay("As you look around, you see two doors in front of you.") |
| 11 | + print_delay("One door is red, and the other door is blue.") |
| 12 | + |
| 13 | +def choose_door(): |
| 14 | + door = "" |
| 15 | + while door != "red" and door != "blue": |
| 16 | + door = input("Which door do you choose? (red/blue): ").lower() |
| 17 | + return door |
| 18 | + |
| 19 | +def red_door_scenario(): |
| 20 | + print_delay("You open the red door and find yourself in a fiery cave.") |
| 21 | + print_delay("There's a dragon sleeping in the middle of the cave!") |
| 22 | + print_delay("You can either:") |
| 23 | + print_delay("1. Try to sneak around the dragon.") |
| 24 | + print_delay("2. Grab a nearby sword and fight the dragon.") |
| 25 | + |
| 26 | + choice = input("Enter 1 or 2: ") |
| 27 | + |
| 28 | + if choice == "1": |
| 29 | + print_delay("You try to sneak around the dragon.") |
| 30 | + print_delay("Unfortunately, the dragon wakes up and chases you!") |
| 31 | + print_delay("You barely manage to escape through the red door.") |
| 32 | + print_delay("You return to the initial room.") |
| 33 | + play_game() |
| 34 | + elif choice == "2": |
| 35 | + print_delay("You pick up the sword and bravely attack the dragon.") |
| 36 | + print_delay("After an intense battle, you defeat the dragon!") |
| 37 | + print_delay("You find a treasure chest behind the dragon's nest.") |
| 38 | + print_delay("The chest contains valuable gems and gold!") |
| 39 | + print_delay("Congratulations! You win!") |
| 40 | + else: |
| 41 | + print_delay("Invalid choice. Please enter 1 or 2.") |
| 42 | + red_door_scenario() |
| 43 | + |
| 44 | +def blue_door_scenario(): |
| 45 | + print_delay("You open the blue door and find yourself in a peaceful garden.") |
| 46 | + print_delay("There's a friendly fairy sitting on a bench.") |
| 47 | + print_delay("The fairy offers you a magical potion.") |
| 48 | + print_delay("You can either:") |
| 49 | + print_delay("1. Drink the potion.") |
| 50 | + print_delay("2. Politely decline the offer.") |
| 51 | + |
| 52 | + choice = input("Enter 1 or 2: ") |
| 53 | + |
| 54 | + if choice == "1": |
| 55 | + print_delay("You drink the potion and feel a sudden burst of energy.") |
| 56 | + print_delay("Your memory is restored, and you remember everything!") |
| 57 | + print_delay("The fairy thanks you for accepting her gift.") |
| 58 | + print_delay("You have a new friend now!") |
| 59 | + print_delay("Congratulations! You win!") |
| 60 | + elif choice == "2": |
| 61 | + print_delay("You politely decline the potion.") |
| 62 | + print_delay("The fairy understands and smiles at you.") |
| 63 | + print_delay("You feel a sense of peace in the garden.") |
| 64 | + print_delay("You've chosen a different path, but it's still a happy ending.") |
| 65 | + print_delay("Congratulations! You win!") |
| 66 | + else: |
| 67 | + print_delay("Invalid choice. Please enter 1 or 2.") |
| 68 | + blue_door_scenario() |
| 69 | + |
| 70 | +def secret_room_scenario(): |
| 71 | + print_delay("You find a hidden passage behind the bookshelf.") |
| 72 | + print_delay("You enter a mysterious room filled with ancient artifacts.") |
| 73 | + print_delay("In the center of the room, there's a glowing amulet.") |
| 74 | + print_delay("You can either:") |
| 75 | + print_delay("1. Take the amulet.") |
| 76 | + print_delay("2. Leave the room without taking anything.") |
| 77 | + |
| 78 | + choice = input("Enter 1 or 2: ") |
| 79 | + |
| 80 | + if choice == "1": |
| 81 | + print_delay("You take the amulet, and it starts to shine even brighter.") |
| 82 | + print_delay("Suddenly, you feel a surge of power flowing through you.") |
| 83 | + print_delay("You've unlocked hidden abilities!") |
| 84 | + print_delay("Congratulations! You win!") |
| 85 | + elif choice == "2": |
| 86 | + print_delay("You decide not to touch anything and leave the room.") |
| 87 | + print_delay("As you exit the secret room, you feel a sense of relief.") |
| 88 | + print_delay("You've chosen a different path, but it's still a happy ending.") |
| 89 | + print_delay("Congratulations! You win!") |
| 90 | + else: |
| 91 | + print_delay("Invalid choice. Please enter 1 or 2.") |
| 92 | + secret_room_scenario() |
| 93 | + |
| 94 | +def play_game(): |
| 95 | + intro() |
| 96 | + chosen_door = choose_door() |
| 97 | + |
| 98 | + if chosen_door == "red": |
| 99 | + red_door_scenario() |
| 100 | + elif chosen_door == "blue": |
| 101 | + blue_door_scenario() |
| 102 | + |
| 103 | + print_delay("You continue exploring and find a hidden door behind a bookshelf.") |
| 104 | + print_delay("Do you want to open the door?") |
| 105 | + hidden_door_choice = input("Enter 'yes' or 'no': ").lower() |
| 106 | + |
| 107 | + if hidden_door_choice == "yes": |
| 108 | + secret_room_scenario() |
| 109 | + else: |
| 110 | + print_delay("You decide not to open the hidden door and continue your adventure.") |
| 111 | + |
| 112 | +if __name__ == "__main__": |
| 113 | + play_game() |
0 commit comments