generated from Code-Institute-Org/p3-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
102 lines (86 loc) · 3.36 KB
/
run.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
def welcome():
print("""The shipwreck was sudden and violent. You woke up on the shore
of a deserted island, surrounded by the wreckage. As you stood, aching and
disoriented, you heard angry shouts. A group of indigenous people emerged from
the jungle, running towards you with alarming speed. You had to decide quickly:
[run] into the forest to hide or [dive] back to the ship's remains on the
beach to find a weapon. Time was running out, and your fate depended
on your next move.
[run] or [dive] ?""")
option = input("\n")
if option == 'dive':
remains()
elif option == 'run':
forest()
else:
invalidoption()
welcome()
def remains():
print("""In the wreckage of the ship, there were no weapons, only debris.
The indigenous people quickly caught up to you, and you were captured and
consumed. This is where your story ends.""")
option = input("Would you like to play again? [yes]/[no]\n")
if option == 'yes':
welcome()
else:
print("Thanks for playing!")
def forest():
print("""You run as the indigenous people chase after you, hurling spears.
Branches scratch your face, and your heart pounds wildly in your chest.
You dive into a ravine, hiding among the bushes. Fortune smiles upon you -
the indigenous people rush past, not noticing your hiding spot. You take
a moment to catch your breath, looking around and contemplating your next
move. Should you go [back] to search for any survivors, or should you
investigate and [enter] the ruined structure that looms in the distance?
[back] or [enter]""")
option = input()
if option == 'back':
returnback()
elif option == 'enter':
enterit()
else:
invalidoption()
forest()
def returnback():
print("""You returned to the beach in search of survivors,
but you failed to notice the lion stalking you. In the end,
you were caught and eaten.""")
option = input("Would you like to play again? [yes]/[no]\n")
if option == 'yes':
welcome()
elif option == 'no':
print("Thanks for playing!")
else:
invalidoption()
returnback()
def enterit():
print("""You stumble upon a native islander, and you are faced with
a choice: rush in and engage in a [fight] or [throw] a rock at him from
a distance. What is your choise? [fight] or [throw]""")
option = input()
if option == 'throw':
throwstone()
elif option == 'fight':
fight()
else:
invalidoption()
enterit()
def fight():
print("""You charged into the fight, but without the necessary skills,
you were easily defeated and killed. Your story ended here.""")
option = input("Would you like to play again? [yes]/[no]\n")
if option == 'yes':
welcome()
else:
print("Thanks for playing!")
def throwstone():
print("""You threw the stone, but it hit a tree, causing coconuts to fall.
One struck the islander on the head, and instead of getting angry, he laughed.
In their tribe, this was a great blessing.
The islander invited you to his village, where they celebrated your arrival
with a festive dinner. The tale of the magical stone and the celebratory
coconut became a legend, bringing laughter to generations.""")
print("""Congratulations! You won the Island Adventure Game!""")
def invalidoption():
print("You entered an invalid option, please try again.")
welcome()