#Initialise#set up dictionariesMAP = {'foyer_forward':'hallway #1','foyer_right':'lounge','foyer_backward':'back door','foyer_left':'bedroom','back door_backward':'garage','back door_forward':'foyer','garage_forward':'back door','bedroom_right':'foyer','bedroom_backward':'bathroom #1','hallway #1_backward':'foyer','hallway #1_forward':'front door','hallway #1_right':'kitchen','hallway #1_left':'study','bathroom #1_forward':'bedroom #1','kitchen_left':'hallway #1','kitchen_right':'pantry','kitchen_forward':'dining room','front door_backward':'hallway #1','front door_forward':'garden','study_left':'stairs #1','study_right':'hallway #1','study_forward':'stairs #2','stairs #1_forward':'basement #1','stairs #1_backward':'basement #5','stairs #1_right':'study','stairs #1_left':'basement #3','basement #1_backward':'stairs','basement #1_forward':'panic room','basement #1_left':'basement #2','basement #2_backwards':'basement #3','basement #2_right':'basement #1','basement #2_forward':'panic room','basement #3_forward':'basement #2','basement #3_backward':'basement #4','basement #3_right':'stairs','basement #4_forward':'basement #3','basement #4_right':'basement #5','basement #4_left':'trap door','basement #5_forward':'stairs','basement #5_left':'basement #4','trap door_backward':'firepit','garden_backward':'front door','garden_right':'tree-house','tree-house_left':'garden #2','garden #2_backward':'front door','garden #2_right':'treehouse','stairs #2_forward':'hallway #2','hallway #2_right':'bedroom #2','hallway #2_left':'torture chamber','hallway #2_backward':'stairs #2','hallway #2_forward':'hallway #3','bedroom #2_backward':'bathroom #2','bedroom #2_left':'walk-in closet','bathroom #2_forward':'bedroom #2','walk-in closet_right':'bedroom #2','torture chamber_left':'hallway #2','torture chamber_right':'cells','torture chamber_backward':'balcony','balcony_forward':'torture chamber','hallway #3_backward':'hallway #2','hallway #3_forward':'stairs #3','hallway #3_left':'hallway #4','hallway #3_right':'poisoned chocolate room','hallway #4_right':'hallway #3','hallway #4_forward':'ice room','hallway #4_left':'hallway #5','hallway #5_right':'hallway #4','hallway #5_forward':'fire room','hallway #5_left':'laundry','stairs #3_forward':'attic','stairs #3_backward':'hallway #3','attic_backward':'stairs #3','attic_forward':'teleport circle', }DESC = {'foyer':'You are in the foyer. It is dark and scary. You want to get out!','back door':'You open the door, but are unsure of where to go. Forwards is the house, and backwards is what seems like an empty garage.','bedroom #1':'You are in the bedroom. It has been redecorated.','lounge':'You are in the loungeroom. Carpet covers broken boards. You fall through.','front door':'The front door is unlocked! It leads to a garden!','kitchen':'A very bare kitchen. There is nothing here.','hallway #1':'A very long hallway with broken floor-boards. It is not safe here.','bathroom #1':'A small bathroom with tiled flooring. There is only a toilet and sink in here.','study':'You have entered a very... white... study. Everywhere you look, you only see white. There is nothing of note here. Please exit this room immediately.','stairs #1':'A random flight of stairs. The number of stairs totals to 1001. No-one knows who counted the number, but the number is on a sign in front of the stairs, warning you of its long length. I wonder what these stairs lead to...','basement #1':'You have entered basement #1. No-one knows why the basements are numbered, they just are. This is a continuation of the stair mystery. This is an empty room.','basement #2':'You have entered basement #2. This room is full of books. This is heaven to all people who love reading books.','basement #3':'You have entered basement #3. This room has a light on, but it still looks dark. Everything in this room is black, making it so that you can barely see anything in this room.','basement #4':'You have entered basement #4. This room is full of lit candles. Be careful not to burn yourself!','basement #5':'You have entered basement #5. This room is empty, though there is a table in the middle of the room with a bowl on it. It seems interesting. You walk up to it. Inside the bowl is a large heap of rice. You try some. It tastes nice!','trap door':'You have entered a trap door! There is only one way out! Through the firepit at the back of the room!','firepit':'You jumped into the firepit expecting death! You got what you wanted! Well done! You died!','garden':'You sprint into the garden, expecting a way out. You look around frantically, but notice no exit. The only thing noteworthy is a tree-house to the right of the garden. Maybe you should check it out!','tree-house':'You climb up the tree to the tree-house at the top. When you get up there, you check for something to help you escape. There is nothing there.','garden #2':'You climb down from the tree-house carefully, sad that you found nothing','pantry':'There is a small pantry over here, but it has little inside it. Its only contents are canned food, and other long-lasting food.','garage':'A garage with room for two cars in it. Sadly, the garage is empty, and the garage door is locked, so you cannot escape out this way.','dining room':'A normal dining room with food on the table. As you walk up to the table, you notice that all the food has gone bad.','stairs #2':'A random flight of stairs. The number of stairs totals to 1001. No-one knows who counted the number, but the number is on a sign in front of the stairs, warning you of its long length. I wonder where these stairs lead to','panic room':'You see a sealed door on the side of Basement #1. You walk up to it and try to open the door. It swings open easily, leading to a dark room. You ender the room, and the door shuts ominously behind you. You are left to wander in the darkness. Suddenly, the lights flicker on and you see shelves apon shelves apon shelves full of the things you need to survive for 100 years. When you spin around and then try to open the door, it is locked shut. Better luck next time! You are now stuck in the panic room of this house, for all eternity!','hallway #2':'You enter a hallway. Its empty.','hallway #3':'You enter a hallway. Its crowded.','hallway #4':'You enter a hallway. Its blue.','hallway #5':'You enter a hallway. Its red.','bedroom #2':'You enter a large bedroom. Whoever used this bedroom sure loved summoning the unnatural! The bedroom is entirely empty, but in the middle of the room, there is a summoning circle. It looks creepy.','bathroom #2':'A very small bathroom with tiled flooring. There are more summoning circles here.','walk-in closet':'A walk-in closet is here. There are no clothes here, just more summoning circles. You should probably leave before you get posessed.','torture chamber':'You walk in to a room filled with items commonly used to torture people. The walls are painted red with blood, and fresh blood drips off of everything. Get out of here quickly... before you become the next person to be tortured!','cells':'You walk in to a room full of cells... with people still in there! They cry out for you to help them. When you try to escape, the door you came in from slams shut behind you, locking you in. You look hesitantly at the other prisoners, wondering if they will hurt you. You slowly walk up to the prisoner with the calmest demeanor, but as soon as you get within a few meters of them, they suddenly snap at you, clawing at your face. They drew some blood. You stagger back, trying to fend them off, but they come closer to you, and you see in their eyes a fiery passion for blood. You go limp and fall to the floor. At this point, all the other prisoners are all screaming for blood. You just stare at your attacker, waiting for the end to come. You can barely hear the prisoners screaming over the pumping of your blood. You try to stand up but fall to the floor. Finally, you give up. What happens happens, and there is no changing it. You give in to your fate as your attacker jumps on you. You close your eyes and the lights go out.','balcony':'Do not ask why the balcony is connected to the torture chamber, no-one knows. SO DO NOT ASK!!!! Anyway, as you walk out on to the balcony, you get to look at your surroundings and see that, surrounding the house, is a whole lot of air. This house is in the sky! But do NOT think of jumping off, as there is a warning sign on the balcony, warning you about the fact that, if you jump off, you will die. Wether that be from the fall distance or the see-through shield surrounding the house, well, that would depend on if you pass the shield or not. (You will not).','poisoned chocolate room':'You walk in to a room filled to the brim with chocolate. THIS IS HEAVEN!!!! Without thinking about it much, you race to the chocolate and take a bit out of it. It tastes like dark chocolate. That was your last thought after the poisoned chocolate you ate killed you.','fire room':'You enter a room full of fire. You burn to death surrounded by a room of red.','ice room':'You enter a room full of ice. You freeze to death surrounded by a room of blue.','laundry':'Youn enter the laundry room. There is nothing of note here.','attic':'You enter the attic. It is a room full of spiderwebs. You try to walk forward, but are held back by the webs. They are stronder than they look! You do not get any on you though. After a while of trying, you finally get to the other side of the room. It looks like there are some teleportation circles here. They do not look like they are teleporting something here, but more like they are teleporting something from here to somewhere else. You wonder if you should enter the circle?','teleport circle':'You walk on to the teleport circle and are instantly teleported somewhere. Looking around, you feel yourself falling. Frantically looking about, you see that below you is a volcano. Before you can realise what happens, you hit the lava and die the slow, painful death of being burned alive.','panic room':'You enter a panic room! Congradulations! You ALMOST escaped! You are now trapped here forever! Destined to waste away while you wait for a rescue that will NEVER come! Good job!','stairs #3':'A random flight of stairs. The number of stairs totals to 1001. No-one knows who counted the number, but the number is on a sign in front of the stairs, warning you of its long length. I wonder what these stairs lead to...', }#set up list of items that end the gameFINISH = ['lounge','quit','firepit','panic room','cells','fire room','ice room','poisoned chocolate room','teleport circle' ]#starting locationroom = 'foyer'#Start of game codename = input('What is your name? ')print ('Hello',name)if name == "Sierra":print("Nice name!")#loops continuously until a break. Note capital letter in boolean value TruewhileTrue:print (DESC[room])if room in FINISH:break direction = input( 'Enter a direction? Choose from forward, backward, left, right or quit ')if direction in FINISH:break key = room + '_' + directionif key in MAP: room = MAP[key]else :print ('You can\'t go ' +direction+'. ' )print ('Game over!')
Twisted Chambers
#Initialise#set up dictionariesMAP = { 'foyer_forward':'front door','foyer_backward':'kitchen','foyer_left':'bedroom','foyer_right':'living room','kitchen_forward':'foyer','kitchen_backward':'potion cellar','kitchen_left':'evil scientist lab','kitchen_right':'dining room','bedroom_backward':'evil scientist lab','bedroom_left':'dungeon','bedroom_right':'foyer','dungeon_backward':'hospital','dungeon_right':'bedroom','hospital_forward':'dungeon','hospital_backward':'bathroom','hospital_right':'evil scientist lab','bathroom_forward':'hospital','bathroom_right':'torture chamber','evil scientist lab_forward':'bedroom','evil scientist lab_backward':'torture chamber','evil scientist lab_left':'hospital','evil scientist lab_right':'kitchen','torture chamber_forward':'evil scientist lab','torture chamber_left':'bathroom','torture chamber_right':'potion cellar','potion cellar_forward':'kitchen','potion cellar_backward':'backdoor','potion cellar_left':'torture chamber','potion cellar_right':'abandoned classroom','abandoned classroom_forward':'dining room','abandoned classroom_left':'potion cellar','dining room_forward':'living room','dining room_backward':'abandoned classroom','dining room_left':'kitchen','living room_left':'foyer','backdoor_forward':'potion cellar','backdoor_backward':'backyard','backdoor_left':'shed','shed_right':'backdoor','backyard_forward':'backdoor' }DESC = {'Haunted house':'You have woken up in the foyer of a haunted house. It is dim and terrifying. You need to get out quickly! ','front door':'The front door is locked! ','bedroom':'You are in the bedroom. You hear strange and disturbing noises from the wardrobe. ','living room':'You are in the living room. The carpet was covering the broken floorboard, you fall and die. ','foyer':'You are in the foyer. It is dim and terrifying. ','kitchen':'You are in the kitchen. The room is lit up red. There is a flashlight on the table. ','dining room':'You are in the dining room. There is rotten food on the table. ','evil scientist lab':'You are in the evil scientist lab. You see weird creatures behind glass. ','hospital':'You are in the hospital. There are dead bodies around the room','dungeon':'You are in the dungeon. There is a ghost vacuum. ','bathroom':'You are in the bathroom. There is blood scattered around. ','torture chamber':'You are in the torture chamber. You see dead bodies hanging. ','potion cellar':'You are in the potion cellar. There are weird chemicals spilt on the floor ','abandoned classroom':'You are in the abandoned classroom. There is writing on the blackboard that you cant read. ','backdoor':'You are at the backdoor. ','backyard':'You are in the backyard. ','shed':'You are in the shed. There is a big ghost. ' }#set up list of items that end the gameFINISH = ['front door','quit','dead','end' ]#set up a list of itemsITEMS = {'ghost vacuum':False,'key':False,'flashlight':False }#starting locationroom = 'foyer'#Start of game codename = input('What is your name? ')print ('Hello',name)print ('You are in a haunted house with many rooms. ')print ('Your challenge is to escape the haunted house without getting killed.')#loops continuously until a break. Note capital letter in boolean value TruewhileTrue:print (DESC[room])# Check to see if the room decription contains the word ghost vacuumif'ghost vacuum'in DESC[room]:# set the ITEMS value for ghost vacuum to be True ITEMS['ghost vacuum'] = True# and inform the userprint('You now have a ghost vacuum') DESC[room] = "You are in the dungeon."if'flashlight'in DESC[room]: ITEMS['flashlight'] = True# Change the desciption of rooms now you have a flashlight. DESC['kitchen'] = 'You are in the kitchen. There is a flashlight.'print('You now have a flashlight')if'big ghost'in DESC[room]:if ITEMS['ghost vacuum'] == True:print('You inhaled the big ghost with your ghost vacuum')print('The big ghost had the key')print('You now have the key') ITEMS['key'] = True DESC['front door'] = 'You use your key and leave the haunted house'else:print('The ghost kills you') room = 'you have died'if room in FINISH:break direction = input( 'Enter a direction? Choose from forward, backward, left, right, or quit ')if direction in FINISH:break key = room + '_' + directionif key in MAP: room = MAP[key]else :print ('You can\'t go ' +direction+'. ' )print ('Game over!')
Zombie Apocalypse adventure game V3
#GAMEdefmain():import time answer = input("Do you want to start this game? [yes/no] ")if answer == "yes":print("Let's get started!") time.sleep(1)print() character_name = input('Hello surivor, what is your name?: ')print("Welcome,", character_name) time.sleep(2)print("You are safe here, have some food, drinks and rest. I am in charge here, you may come to me if you need anything") time.sleep(4) answer = input("You are at a basecamp, you are safe here from the zombie apocalypse. You must eliminate zombies and save people! Do you wish to travel to a Mansion(left) or a Theme Park(right)? [left/right]")#LEAVING BASE CAMP-LEFT OPTIONif answer == "left":print()print("You have left base camp and entered an abandoned mansion") time.sleep(2)print()print("Decide where you want to proceed in the MANSION")print()print("Press D to enter the dining room, where you hear a groaning noise") time.sleep(2)print("Press B to enter the master bedroom, where you hear breathing") time.sleep(2)print("Press K to enter the kitchen, where you see a light, and hear breathing") time.sleep(2)print("Press X to exit the mansion and to return to base camp") time.sleep(2) answer = input("Press keys in capital letters [D/B/K/X]")#DINING ROOMif answer =="D":print()print("You are in the dining room and you find a zombie looking at the wall") time.sleep(1)print("The zombie has seen you and attacks you! YOU DIED!")print() time.sleep(2)print("Game Over")#BEDROOMelif answer == "B":print()print("You entered the bedroom, it is pitch dark, and the fans are slowly spinning.") time.sleep(1)print("You take out your torch and look around") answer = input("You might have an opportunity to save survivors, you can choose to look under the bed(u) or inside the wardrobe <img width="16" height="16" class="wp-smiley emoji" draggable="false" alt="(w)" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/wordpress.svg" style="height: 1em; max-height: 1em;"> [u/w]")#UNDER THE BED if answer == "u":print()print("There is noone under the bed, except for an armless zombie, who sees you, snatches your pistol from its mouth, and eats you") time.sleep(2)print()print("YOU DIED! Game over")#IN THE WARDROBEelif answer == "w":print()print("You see a family of four in the wardrobe.") time.sleep(1)print()print("CONGRATULATIONS! You saved a group of survivors, and they reach your base camp safely") time.sleep(2)print("MISSION PASSED!")#KITCHENelif answer == "K":print()print("You see the butler standing, with his back turned, you try to get his attention and he turns around, which is when you see his ruined face") time.sleep(3)print("The butler is infected and became a zombie!") answer = input("You're able to throw what looks like hot kettle water at it (t), or use your knife to kill it (h) [t/h]")#THROW WATERif answer == "t": print()print("The water is only a little hot, and does nothing, the zombie grabs on to you and eats you!") time.sleep(2)print("YOU DIED! GAME OVER")#STAB WITH YOUR KNIFE elif answer == "h":print()print("You stab the zombie in the neck, which happens to be it's weak spot. The zombie is beheaded, and falls to the floor, dead") time.sleep(2)print("You see the cabinet move") time.sleep(3)print("The maid was hiding from the zombie inside the cabinet, congratulations, you saved a survivor, and now go look for the rest") time.sleep(4)print("Game over")#EXIT MANSIONelif answer == "X":print()print("You abandoned your search of the mansion")print(character_name, "your companions are disappointed...Your boss sends another companion to search again. YOU FAILED")print() time.sleep(2)print("Game Over")else:print("INVALID COMMMAND. You are unable to go that way")#LEAVING BASE CAMP-RIGHT OPTIONelif answer == "right":print()print("You have left base camp and entered an abandoned theme park") time.sleep(2)print()print("Decide where you want to proceed in the THEME PARK") time.sleep(2)print()print("Press R to ride a roller coaster, which looks dangerous, and you do not see the end, but it could lead somewhere") time.sleep(2)print("Press C to enter a cafe") time.sleep(2)print("Press F to walk towards some footsteps and distant noises you hear") time.sleep(2)print("Press E to exit the theme park and return to base camp") time.sleep(2) answer = input("Press keys in capital letters [R/C/F/E]")#ROLLER COASTERif answer =="R":print()print("You are riding a dangerous looking roller coaster. You see a zombie crawling on the rails") time.sleep(2)print("You manage to run over the zombie and kill it, but the track ends there, and you fall") time.sleep(2)print("You miraculously survive the fall, but you haven't found and saved anyone uninfected yet, and you feel a huge pain in your legs") time.sleep(3)print()print("You have broken both of your legs. You send a blaze for help and your companions show up to rescue you.") time.sleep(2)print(character_name, "YOU FAILED THE MISSION")#Cafeelif answer == "C":print()print("You are now in the Cafe. You see a man, bleeding out, and he says in a raspy voice:") time.sleep(2)print("'watch out, th- they're near...', and then dies.") time.sleep(3)print("You get a weird feeling that you are being watched") time.sleep(2)print("Then you turn around and see a zombie with a hideously deformed face and a body which you can see right through jump on you.") time.sleep(4) answer = input("You have the choice to use your pistol to shoot it (s) or punch it continuously in the head (p) [p/s]")#SHOOT THE ZOMBIEif answer == "s": print()print("The bullets shoot right through the zombie, but do not do anything, and the zombie proceeds to eat you") time.sleep(2)print("MISSION FAILED: YOU DIED! Game over!")#PUNCH THE ZOMBIEif answer == "p": print()print("You wrestle the zombie and keep punching it. The zombie eventually dies as the head was the soft spot of the zombie") time.sleep(2)print("Great work! You eliminated a zombie! However, you did not rescue anyone yet")print("You continue to search for survivors, with a broken, and seemingly slightly infected leg. Game over") #FOOTSTEPS AND NOISESelif answer == "F":print()print("You hear footsteps and distant noises, you turn around the corner and see a group of people surrounded by a large horde of zombies, and on your right is a corpse") time.sleep(2)print("The corpse had a loaded shotgun next to it. Your gun is jammed, and the zombies are coming quickly. You use the shotgun to kill the zombies and save the survivors") time.sleep(2)print() time.sleep(2)print(character_name, "CONGRATULATIONS! You saved survivors, who managed to reach the base camp safely. MISSION PASSED")#EXIT MANSIONelif answer == "E":print()print("You abandoned your search of the theme park")print("Your companions are disappointed...Your boss sends another companion to search again. YOU FAILED") time.sleep(2)print()print("Game Over")else:print("INVALID COMMMAND. You are unable to go that way")else:print("INVALID COMMAND: Please select from given options") restart=input("Do you wish to start again?[yes/no]")if restart == "yes": main()else:exit()else:print("Okay, you can always play later!")#WRITE DOWN MAIN TO START CODE main()