repl.it
Python

No description

fork
loading
Files
  • main.py
main.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
current_room = "yard"
current_lives = 3
import random
print("Welcome to Zork! A land of adventure, young challenger!")
name = input("In this story you can be a hero or a heroine. Choose one!\n")
print("Welcome", name + "!")
while current_lives == 0:
  print("You died! Play again sometime!")
  break
while current_lives > 0:
  while current_room == "yard":
    print("You wake up seeing youself awake in front of a house. You see a door but it seems to be locked and all of the windows are blocked. To the right of you there is a mailbox.") 
    response1 = input("What will you do?\n")
    if response1 == 'open mailbox' or response1 == 'check mail' or response1 == 'check mailbox':
      print("You find a leaflet and it states: WELCOME TO ZORK", name.strip().upper() + "!", "YOU WILL FIND GREAT ADVENTURE AND NEW ABILITIES YOU NEVER KNEW YOU HAD! BUT ON THE WAY, YOU WILL MEET THE WORST MONSTERS AND WILL HAVE TO DESTROY THEM TO REMEDY YOUR CURSE OF BEING STUCK IN THE HOUSE! HERE ARE THE RULES: YOU WILL HAVE TO PERFORM ACTIONS IN ALMOST EVERY ROOM AND RECIEVE SOME USEFUL ITEMS THAT CAN BE HELPFUL IN ESCAPING THE HOUSE! MOST ROOMS WILL HAVE THESE TYPES OF ITEMS. IN ORDER TO MAKE THE PROCESS EASIER, THE COMPUTER WILL TELL YOU IF THERE IS A HELPFUL ITEM IN THAT ROOM. BEWARE, YOU MAY DIE ON YOUR ESCAPE OUT OF THE HOUSE!\n")
    else: 
      print("I do not understand! Try a different phrase!\n")
    print("Now that you have read the leaflet, the door to the mansion has opened. A goblin approaches you from behind.\n")
    response2 = input("What will you do?\n")
    if response2 == 'go to door' or response2 == 'enter house' or response2 == 'enter door':
      print("You are now in the entrance hallway. To the west of you there seems to be a bathroom. To the east, there seems to be a living room. To the north, there seems to be a chandelier.\n")
      current_room = "hallway"
    else: 
      print("I do not understand! Try a different phrase!\n")
  while current_room == "hallway":
    response3 = input("Pick a direction to go or type in the room you want to go to.\n")
    if response3 == 'north' or response3 == 'chandelier room' or response3 == 'chandelier':
      print("There is one helpful item in this room but it is high up and is unobtainable as of now.\n")
    elif response3 == 'west' or response3 == 'bathroom':
      print("There is one helpful item in this room.")
      current_room = "bathroom"
      while current_room == "bathroom":
        print("You are now in the bathroom! You have a great urge to search the room. In this room there is: a toilet, a shower, a sink, a trash can, and some toilet paper.")
        response4 = input("What will you search?\n") 
        if response4 == 'search toilet' or response4 == 'search shower' or response4 == 'search trash can' or response4 == "search toilet paper" or response4 == "check toilet" or response4 == "check shower" or response4 == "check trash can" or response4 == "check toilet paper" or response4 == 'toilet' or response4 == 'shower' or response4 == 'trash can' or response4 == 'toilet paper':
          print("The helpful item is not here!")
        elif response4 == 'search sink' or response4 == 'check sink' or response4 == 'sink':
          print("Congrats! You found the helpful item! It is a lamp which can help you see in the dark! You are now back in the hallway!")
          current_room = 'hallway'
        else: 
            ("I do not understand! Try a different phrase!\n")
    elif response3 == 'east' or 'living room':
      print("There are no helpful items here, but if you go north there is a bathroom MIGHT just MIGHT be a useful item")
      current_room = "living room"
      while current_room == "living room":
        response5 = input("What will you do?\n")
        if response5 == 'north' or response5 == 'go to bathroom'  or response5 =='enter bathroom':
          print("Oh no! You look in the mirror only to see a Grim Reaper and he comes out and kills you!")
          current_lives -= 1
          current_room = "hallway"
          print("You have", current_lives, "lives left!")
        elif response5 == 'leave room' or response5 == 'get out' or response5 == 'get out of room' or response5 == 'leave living room' or response5 == 'get out of living room':
          current_room = "hallway"
        else:
          print("I do not understand! Try a different phrase!\n")
          current_room = "living room"
        current_room = "hallway2"
      while current_room == "hallway2":
        print("Now you have checked all rooms surrounding the hallway! There are still 4 more rooms on this floor! They are the kitchen, garage, family room, and library! Right now, you are in another hallway called hallway2!")
        response6 = input("Where would you like to go?")
        if response6 == 'kitchen' or response6 == 'go to kitchen':
          print("There are no helpful items in this room. You are now leaving this room.")
          current_room = "hallway2"
        elif response6 == 'garage' or response6 == 'go to garage':
          print("There is one helpful item in this room. There is a shelf, a rack, a and a trash can.")
          response7 = input("What would you like to search?")
          if response7 == 'rack' or response7 == 'search rack' or response7 == 'check rack' or response7 =='trash can' or response7 == 'search trash can' or response7 == 'check trash can':
            print("The helpful item is not here!")
          if response7 == 'shelf' or response7 == 'search shelf' or response7 == 'check shelf':
            print("Congratulations! You have found the helpful item! It is a ladder which can be used to reach one of the helpful, but not essential item. The one on the chandelier!")
            response8 = input("Would you like to go there? (Yes or No)\n")
            if response8 == 'Yes':
              ("You have found the Old Warrior's Secret! It states: Oh you have found my letter! Just as I was expecting, you are unlike the rest of your kind you actully have the logic read this! The gatekeeper's weekness is that she has an ego and if you can irritate her she will be vulnerable to attacks in the leg. Once you are passed this irrelevant organism, you may move on to your final fight of your journey. The dragon is quite vulnerable to the bow in the throat area. However, you might not be 100% successful in your attacks. Now, my friend, it is time for me to go. Good luck on your journey!")
            elif response8 == 'No':
              current_room = "hallway2"
          else:
            print("I do not understand! Try a different word or phrase.")
        elif response6 == 'library' or response6 == 'go to library':
          print("There is no helpful item in this room, but there is a secret entrance behind a shelf which requires a sword to open.")
          current_room = "hallway2"
        elif response6 == 'family room' or response6 == 'go to family room':
          print("There is one helpful item in this room. There is a rug, couch, coffee table, and a TV.")
          response9 = input("What would you like to search?\n")
          if response9 == 'couch' or response9 == 'search couch' or response9 == 'check couch' or response9 == 'coffee table' or response9 == 'search coffee table' or response9 == 'search table' or response9 == 'TV' or response9 == 'search TV' or response9 == 'check TV':
            print("The helpful item is not here!") 
          if response9 == 'rug' or response9 == 'search rug' or response9 == 'check rug':
            print("Congrats! You have found the shield! It will help you in fights! Now you must go upstairs to get more items, before you head to the basement for your final battle.")
            current_room = "staircase"
          else:
            print("I do not understand! Try a different word or phrase.")
        while current_room == "staircase":
          print("You are going up the stairs and are now upstairs.")
          current_room = "upstairs"
        while current_room == "upstairs":
          print("You are now upstairs. There is a sword room, a storage room, and a recreational room, a loft, and a food storage room.")
          response10 = input("Where would you like to go? Enter the name of the room in which you'd like to go.")
          if response10 == 'sword room' or response10 == 'go to sword room':
            print("There is one ESSENTIAL item in this room. In this room, there is only a table. On the table there is a scabbard.")
            response11 = input("Would you like to pick it up?")
            if response11 == 'Yes' or response11 == 'yes':
              print("You have picked up the scabbard for the legendary sword! You are now being sent back to the corridor leading to all of the rooms upstairs again!")
              current_room = 'upstairs'
            elif response11 == 'No' or response11 == 'no':
              print("Okay then, it is impossible to win the game now.... oof... GOOD LUCK!")
              current_room = 'upstairs'
          elif response10 == 'go to storage room' or response10 == 'storage room':
            print("After you have entered the storage room, you spot a shovel from the corner of your eye. This could be very useful later on.")
            response12 = input("Would you like to pick it up?")
            if response12 == 'Yes' or response12 == 'yes':
              print("Nicely done! You have now acquired the shovel!")
              current_room = 'upstairs'
            elif response12 == 'No' or response12 == 'no':
              print("That was a bad decision! You'll have to live with it!")
              current_room = 'upstairs'
          elif response10 == 'rec room' or response10 == 'recreational room' or response10 == 'go to rec room' or response10 == 'go to recreational room':
            print("There is an incredibly important item here! In this room, there is a drawer, a ping-pong table, a treadmill, a foosball table, and a pool table.")
            response13 = input("What would you like to search?")
            if response13 == 'ping-pong table' or response13 == 'check ping-pong table' or response13 == 'search ping-pong table' or response13 == 'ping pong table' or response13 == 'check ping pong table' or response13 == 'search ping pong table' or response13 == 'treadmill' or response13 == 'check treadmill' or response13 == 'search treadmill' or response13 == 'foosball table' or response13 == 'check foosball table' or response13 == 'search foosball table' or response13 == 'pool table' or response13 == 'check pool table' or response13 == 'search pool table':
              print("The special item is not here!")
              current_room = 'upstairs'
            elif response13 == 'drawer' or response13 == 'check drawer' or 'search drawer':
              print("You have found the special item! It is a bow and a quiver full of arrows which can be very useful in combat.")
              current_room = 'upstairs'
          elif response10 == 'loft' or response10 == 'go to loft':
            print("There is one very important item in this room. There is a storage bin, a bookshelf, and a couch, all of which you can search.")
            response14 = input("What would you like to search?")
            if response14 == 'bookshelf' or response14 == 'check bookshelf' or response14 == 'search bookshelf' or response14 == 'couch' or response14 == 'check couch' or response14 == 'search couch':
              print("The special item is not here!")
              current_room = 'upstairs'
            elif response14 == 'storage bin' or response14 == 'check storage bin' or response14 == 'search storage bin':
              print("You have found the special item! It is a key which you will need in order to unlock something later on!")
              current_room = 'upstairs'
          elif response10 == 'food storage room' or response10 == 'go to food storage room':
            print("In this room, there is nothing too special. You can just eat some food and go and I suggest that you do eat.")
            response15 = input("Would you like to eat?")
            if response15 == 'Yes' or response15 == 'yes':
              print("You are now fully recharged and are good to go.")
              current_room = 'upstairs'
            elif response15 == 'No' or response15 == 'no':
              print("That is fine! Continue your journey", name + "!")
              current_room = 'upstairs'
          else:
            print("I do not understand! Try a different phrase!")
          print("Now that you have visited all of the rooms upstairs, you are teleported to the library and you put your sword into the sword shrine. After you do this, a secret entrance appears and you enter through that secret entrance.")
          current_room = 'basement'
        while current_room == 'basement': 
          print("Now that you have finished searching everything in every room, you are magically transported to the underground where you see only one passage to the north after you go through the passage, you meet a ferocious mutant spider gate keeper. You will have to kill it in order to move on.\n")
          response16 = input("What will you do")
          if response16 == 'attack' or response16 == 'attack spider' or response16 == 'kill' or response16 == 'kill spider':
            if random.randint(0,1) == 1:
              print("You have killed the spider! A door to a room opens and as you enter you see the horrible sight of all of the dead heroes who have died here over the ages. A huge gate opens to reveal your final task: You must defeat this horrible dragon in order to return home.\n")
              current_room = 'arena'
            else:
              print("Oh no! You missed and the spider attacks you and you die!\n")
              current_lives -= 1
              print("You have", current_lives, "lives left!\n")
          while current_room == 'arena':
            current_lives == 1
            print("Ahh you have come hero you will ony die like the rest.\n")
            response17 = input("What will you do, attack, dodge or sheild.\n")
            if response17 == 'attack':
              print("You have landed a hit on the dragon.\n")
              print("You won't survive this!\n")
            else:
              print("The dragon has stabbed you with his claw, you die!\n")
            response18 = input("What will you do, attack, dodge or sheild.\n")
            if response18 == 'dodge':
              print("You managed to dodge his malicious attack.")
              print("Why are you trying to live, just let me kill you!\n")
            else:
              print("The dragon has taken you and dropped you from the sky, you died!\n")
            response19 = input("What will you do, attack, dodge or sheild.\n")
            if response19 == 'shield':
              print("You shield the flames as they turn into harmless mist.\n ")
              print("I will destroy you\n")
            else:
              print("The dragons flames have turned you to dust, you have died!\n")
            response20 = input("What will you do, attack, dodge or sheild\n")
            if response20 == 'attack':
              print("You have landed a hit on the dragon and as he dies he says his so-called last words.\n")
              print("You will... I will be back!\n ")
              current_room = 'vault'
            else:
              print("Haha you have been coroded by me minions kill him\n")
              print("He has taken your soul and turned you into his minion, you died\n")
              break
          while current_room == 'vault':
            print("There is a chest and when you open it you find treasures and you escape the land carrying you treasures throught a portal, into the unknown.........\n")
            break