Repository navigation
Expand file tree
/
Copy pathtext_based_game.py
More file actions
93 lines (72 loc) · 2.46 KB
/
Copy pathtext_based_game.py
File metadata and controls
93 lines (72 loc) · 2.46 KB
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
answer_A = ["A", "a"]
answer_B = ["B", "b"]
answer_C = ["C", "c"]
yes = ["Y", "y", "yes"]
no = ["N", "n", "no"]
sword = False
def intro():
print("After a drunken night out with friends, you awaken in a thick, dank forest. A slobbering orc is running towards you.")
print("A. Grab a nearby rock and throw it at the orc")
print("B. Lie down and wait to be mauled")
print("C. Run")
choice = str(input())
if choice in answer_A:
option_rock()
elif choice in answer_B:
print("Welp, that was quick. You died!")
elif choice in answer_C:
option_run()
def option_rock():
print("The orc is stunned, but regains control. He begins running towards you again.")
print("A. Run")
print("B. Throw another rock")
print("C. Run towards a nearby cave")
choice = str(input())
if choice in answer_A:
option_run()
elif choice in answer_B:
print("The rock flew well over the orcs head. You missed. You died!")
elif choice in answer_C:
option_cave()
def option_cave():
print("Before you fully enter, you notice a shiny sword on the ground. Do you pick up a sword. Y/N?")
choice = str(input())
if choice in yes:
sword = True
elif choice in no:
sword = False
print("What do you do next?")
print("A. Hide in silence")
print("B. Fight")
print("C. Run")
choice = str(input())
if choice in answer_A:
print("I think orcs can see very well in the dark, right? You died!")
elif choice in answer_B:
if sword == False:
print("You're defenseless. You died!")
elif sword == True:
print("As the orc reached out to grab the sword, you pierced the blade into its chest. You survived!")
elif choice in answer_C:
print("The orc turns around and sees you running.")
option_run()
def option_run():
print("You run as quickly as possible.")
print("A. Hide behind boulder")
print("B. Trapped, so you fight")
print("C. Run towards an abandoned town")
choice = str(input())
if choice in answer_A:
print("You're easily spotted. You died!")
elif choice in answer_B:
print("You're no match for an orc. You died!")
elif choice in answer_C:
option_town()
def option_town():
print("You notice a purple flower near your foot. Do you pick it up? Y/N")
choice = str(input())
if choice in yes:
print("You quickly hold out the purple flower. The orc was looking for love. This got weird, but you survived!")
elif choice in no:
print("Maybe you should have picked up the flower. You died!")
intro()