1
1
import time
2
2
3
+
3
4
def print_delay (text , delay = 1 ):
4
5
print (text )
5
6
time .sleep (delay )
6
7
8
+
7
9
def intro ():
8
10
print_delay ("You wake up in a dark, mysterious room." )
9
11
print_delay ("You can't remember how you got here." )
10
12
print_delay ("As you look around, you see two doors in front of you." )
11
13
print_delay ("One door is red, and the other door is blue." )
12
14
15
+
13
16
def choose_door ():
14
17
door = ""
15
18
while door != "red" and door != "blue" :
16
19
door = input ("Which door do you choose? (red/blue): " ).lower ()
17
20
return door
18
21
22
+
19
23
def red_door_scenario ():
20
24
print_delay ("You open the red door and find yourself in a fiery cave." )
21
25
print_delay ("There's a dragon sleeping in the middle of the cave!" )
@@ -41,6 +45,7 @@ def red_door_scenario():
41
45
print_delay ("Invalid choice. Please enter 1 or 2." )
42
46
red_door_scenario ()
43
47
48
+
44
49
def blue_door_scenario ():
45
50
print_delay ("You open the blue door and find yourself in a peaceful garden." )
46
51
print_delay ("There's a friendly fairy sitting on a bench." )
@@ -61,12 +66,14 @@ def blue_door_scenario():
61
66
print_delay ("You politely decline the potion." )
62
67
print_delay ("The fairy understands and smiles at you." )
63
68
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." )
69
+ print_delay (
70
+ "You've chosen a different path, but it's still a happy ending." )
65
71
print_delay ("Congratulations! You win!" )
66
72
else :
67
73
print_delay ("Invalid choice. Please enter 1 or 2." )
68
74
blue_door_scenario ()
69
75
76
+
70
77
def secret_room_scenario ():
71
78
print_delay ("You find a hidden passage behind the bookshelf." )
72
79
print_delay ("You enter a mysterious room filled with ancient artifacts." )
@@ -78,19 +85,22 @@ def secret_room_scenario():
78
85
choice = input ("Enter 1 or 2: " )
79
86
80
87
if choice == "1" :
81
- print_delay ("You take the amulet, and it starts to shine even brighter." )
88
+ print_delay (
89
+ "You take the amulet, and it starts to shine even brighter." )
82
90
print_delay ("Suddenly, you feel a surge of power flowing through you." )
83
91
print_delay ("You've unlocked hidden abilities!" )
84
92
print_delay ("Congratulations! You win!" )
85
93
elif choice == "2" :
86
94
print_delay ("You decide not to touch anything and leave the room." )
87
95
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." )
96
+ print_delay (
97
+ "You've chosen a different path, but it's still a happy ending." )
89
98
print_delay ("Congratulations! You win!" )
90
99
else :
91
100
print_delay ("Invalid choice. Please enter 1 or 2." )
92
101
secret_room_scenario ()
93
102
103
+
94
104
def play_game ():
95
105
intro ()
96
106
chosen_door = choose_door ()
@@ -100,14 +110,17 @@ def play_game():
100
110
elif chosen_door == "blue" :
101
111
blue_door_scenario ()
102
112
103
- print_delay ("You continue exploring and find a hidden door behind a bookshelf." )
113
+ print_delay (
114
+ "You continue exploring and find a hidden door behind a bookshelf." )
104
115
print_delay ("Do you want to open the door?" )
105
116
hidden_door_choice = input ("Enter 'yes' or 'no': " ).lower ()
106
117
107
118
if hidden_door_choice == "yes" :
108
119
secret_room_scenario ()
109
120
else :
110
- print_delay ("You decide not to open the hidden door and continue your adventure." )
121
+ print_delay (
122
+ "You decide not to open the hidden door and continue your adventure." )
123
+
111
124
112
125
if __name__ == "__main__" :
113
126
play_game ()
0 commit comments