-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrail2.py
241 lines (204 loc) · 8.53 KB
/
trail2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
import time
import random
visited_locations = [] # To store visited locations
player_inventory = [] # To store items the player collects
def introduction():
print("Welcome, Chosen One, to the Treasure Hunt!")
time.sleep(1)
player_name = input("What is your name?")
print(f"Welcome, {player_name}, to the Treasure Hunt!")
time.sleep(1)
print(f"{player_name}, you find yourself on a remote island with a mysterious treasure map in hand.")
time.sleep(1)
print("It is said that only the Chosen One can unlock the secrets of this treasure.")
time.sleep(1)
print("Your goal is to follow the clues and find the hidden treasure.")
time.sleep(1)
print("Let's begin your adventure!")
def beach():
print("\nYou start your journey on a beautiful sandy beach.")
time.sleep(1)
options = []
if 'jungle' not in visited_locations:
print("1. Follow the path into the dense jungle.")
options.append("1")
if 'cliffs' not in visited_locations:
print("2. Explore the rocky cliffs to your left.")
options.append("2")
if 'shipwreck' not in visited_locations:
print("3. Check the old shipwreck on your right.")
options.append("3")
if options:
choice = input("Which path will you choose? (" + "/".join(options) + "): ")
if choice == '1' and 'jungle' not in visited_locations:
jungle()
elif choice == '2' and 'cliffs' not in visited_locations:
cliffs()
elif choice == '3' and 'shipwreck' not in visited_locations:
shipwreck()
else:
print("Invalid choice. Try again.")
beach()
else:
print("You have already explored all available paths.")
continue_exploring()
def jungle():
visited_locations.append('jungle')
print("\nYou venture into the dense jungle.")
time.sleep(1)
print("The path is overgrown, and it's getting darker as you go deeper.")
time.sleep(1)
# Encounter with locals who provide a hint
print("You meet some locals who recognize you as the Chosen One.")
time.sleep(1)
print("They say, 'The treasure you seek lies deep within this jungle, Chosen One.'")
time.sleep(1)
# Encounter with a demon
print("As you proceed, a fierce demon blocks your path!")
time.sleep(1)
print("You must fight the demon to continue.")
# Player's choice to fight or flee
choice = input("Do you want to fight the demon or flee? (fight/flee): ")
if choice == 'fight':
print("The demon was too strong, and you were defeated. You wake up on the beach.")
beach()
elif choice == 'flee':
print("You wisely choose to flee from the demon.")
visited_locations.remove('jungle') # Allow the player to revisit the jungle later
beach()
else:
print("Invalid choice. Try again.")
jungle()
def cliffs():
visited_locations.append('cliffs')
print("\nYou climb the rocky cliffs to explore.")
time.sleep(1)
print("From the top, you have a great view of the island.")
time.sleep(1)
# Encounter with a fisherman who provides a hint
print("You meet a fisherman who recognizes you as the Chosen One.")
time.sleep(1)
print("He says, 'Legend has it that the treasure lies near a waterfall, Chosen One.'")
time.sleep(1)
print("You find an ancient riddle carved into the rocks:")
time.sleep(1)
print("I speak without a mouth and hear without ears. I have no body, but I come alive with the wind.")
options = ["a) an echo", "b) a shadow", "c) a secret"]
print("Choose the correct answer by typing the letter:")
print("\n".join(options))
answer = input("Your choice (a/b/c): ").lower()
if answer == 'a':
print("You've solved the riddle! You may proceed.")
waterfall()
else:
print("That's not the correct answer. The riddle seems to be unsolvable for now.")
# Unable to find the treasure outcome
print("Unfortunately, you are unable to find the treasure.")
time.sleep(1)
print("But remember, Chosen One, legends never truly die.")
time.sleep(1)
print("You return to the village with stories of your adventure.")
time.sleep(1)
print("Thanks for playing!")
def shipwreck():
visited_locations.append('shipwreck')
print("\nYou investigate the old shipwreck.")
time.sleep(1)
# Discovery of a hidden chest
print("The ship is in ruins, but you find a hidden chest inside:")
time.sleep(1)
print("1. Open the chest.")
time.sleep(1)
print("2. Leave the shipwreck and continue exploring.")
choice = input("What will you do? (1/2): ")
if choice == '1':
treasure_found()
elif choice == '2':
continue_exploring()
else:
print("Invalid choice. Try again.")
shipwreck()
def waterfall():
visited_locations.append('waterfall')
print("\nYou follow the path uphill and discover a beautiful waterfall.")
time.sleep(1)
# Decision to enter the cave with a riddle
print("There's a small cave behind the waterfall:")
time.sleep(1)
# Riddle with options
print("Inside the cave, you find an engraving on the wall:")
time.sleep(1)
print(
"I am not alive, but I can grow; I don't have lungs, but I need air; I don't have a mouth, but water kills me. What am I?")
options = ["a) a fire", "b) a tree", "c) a river"]
print("Choose the correct answer by typing the letter:")
print("\n".join(options))
answer = input("Your choice (a/b/c): ").lower()
if answer == 'b':
print("You've solved the riddle! You may proceed.")
cave()
else:
print("That's not the correct answer. The riddle remains unsolved.")
# Unable to find the treasure outcome
print("Unfortunately, you are unable to find the treasure.")
time.sleep(1)
print("But remember, Chosen One, legends never truly die.")
time.sleep(1)
print("You return to the village with stories of your adventure.")
time.sleep(1)
print("Thanks for playing!")
def cave():
visited_locations.append('cave')
print("\nYou enter a dark cave.")
time.sleep(1)
print("It's damp and echoey, and you can hear the sound of dripping water.")
time.sleep(1)
# Riddle with options
print("You find a puzzle on the cave wall:")
time.sleep(1)
print(
"I'm taken from a mine, and shut up in a wooden case, from which I'm never released, and yet I am used by almost every person.")
options = ["a) a treasure", "b) a secret", "c) a pencil lead"]
print("Choose the correct answer by typing the letter:")
print("\n".join(options))
answer = input("Your choice (a/b/c): ").lower()
if answer == 'c':
print("You've solved the puzzle! You may proceed.")
treasure_found()
else:
print("That's not the correct answer. The puzzle remains unsolved.")
# Unable to find the treasure outcome
print("Unfortunately, you are unable to find the treasure.")
time.sleep(1)
print("But remember, Chosen One, legends never truly die.")
time.sleep(1)
print("You return to the village with stories of your adventure.")
time.sleep(1)
print("Thanks for playing!")
def treasure_found():
print("\nAs you venture deeper into the cave, you stumble upon a hidden treasure chest!")
time.sleep(1)
print("You've found the treasure!")
time.sleep(1)
print("Congratulations, Chosen One! You have fulfilled the prophecy and become a successful treasure hunter!")
time.sleep(1)
print("You return to the village as a hero, and your name is remembered for generations.")
time.sleep(1)
print("Thanks for playing!")
exit()
def continue_exploring():
print("\nYou decide to leave the shipwreck and continue exploring the island.")
time.sleep(1)
print("You search for more clues and keep your hopes up.")
time.sleep(1)
# Unable to find the treasure outcome
print("Unfortunately, you are unable to find the treasure.")
time.sleep(1)
print("But remember, Chosen One, legends never truly die.")
time.sleep(1)
print("You return to the village with stories of your adventure.")
time.sleep(1)
print("Thanks for playing!")
# Main game loop
introduction()
beach()