def NorthofHouse(north_house_inp, itemList): if north_house_inp.lower() == ("go south"): return [True, 0] elif north_house_inp.lower() == ("go north"): return [True, 11] elif north_house_inp.lower() == ("swim"): print("---------------------------------------------------------") print( "You don't have a change of clothes and you aren't here on vacation." ) return [True, 1] elif north_house_inp.lower() == ("fish"): print("---------------------------------------------------------") print("You spend some time fishing.") print("You gain a fish.") return [True, 1, items.pick_up("fish", 1)] elif north_house_inp[0:4].lower() == ("take"): return [True, 1, items.pick_up(north_house_inp[5:], 1)] elif north_house_inp.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif second[0:8].lower() == ("put down"): if second[9:].lower() in itemList: items.put_down(second[9:], 1) return [True, 1] else: return [True, 1] else: print("---------------------------------------------------------") return [True, 1]
def north_of_house(north_house_inp): status = 'alive' room_num = 1 if north_house_inp.lower() == ("go south"): room_num = 4 elif north_house_inp.lower() == ("swim"): print("---------------------------------------------------------") print( "You don't have a change of clothes and you aren't here on vacation." ) elif north_house_inp.lower() == ("fish"): print("---------------------------------------------------------") print("You spend some time fishing but nothing seems to bite.") elif north_house_inp.lower().startswith("put down"): item = items.put_down(north_house_inp[9:], 1) my_item_list.remove(item) elif north_house_inp.lower().startswith("pick up"): item = items.pick_up(north_house_inp[8:], 1) my_item_list.append(item) elif north_house_inp.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status
def grating_loop_and_cave(cave_inp): status = 'alive' room_num = 10 if cave_inp.lower() == ("descend staircase"): room_num = 11 elif cave_inp.lower() == ("take skeleton"): print("---------------------------------------------------------") print("Why would you do that? Are you some sort of sicko?") elif cave_inp.lower() == ("smash skeleton"): print("---------------------------------------------------------") print("Sick person. Have some respect mate.") elif cave_inp.lower() == ("light up room"): print("---------------------------------------------------------") print("You would need a torch or lamp to do that.") elif cave_inp.lower() == ("break skeleton"): print("---------------------------------------------------------") print("I have two questions: Why and With What?") elif cave_inp.lower() == ("go down staircase"): room_num = 11 elif cave_inp.lower() == ("enter maze"): room_num = 15 elif cave_inp.lower().startswith("put down"): item = items.put_down(cave_inp[9:], 10) my_item_list.remove(item) elif cave_inp.lower().startswith("pick up"): item = items.pick_up(cave_inp[8:], 10) my_item_list.append(item) elif cave_inp.lower() == ("kick the bucket"): status = 'dead' elif cave_inp.lower() == ("scale staircase"): room_num = 11 else: print("---------------------------------------------------------") return room_num, status
def room13(user_input, itemList): gained_item = [] if user_input.lower() == ("going up"): loop = 14 living_status = 'Alive' elif user_input.lower() == ('take lantern'): living_status = 'Alive' loop = 13 p = items.pick_up('lantern') if p != -1: gained_items.append('lantern') print('Item Gained: lantern') else: print('You already have this item') elif user_input.lower() == ("going east"): loop = 12 living_status = 'Alive' elif user_input.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") living_status = 'Dead' dead_inp = living_status exit_function(dead_inp) else: print("---------------------------------------------------------") loop = 13 living_status = 'Alive' return [loop, living_status]
def EndOfGame(last_inp, itemList): if last_inp.lower() == ("open trunk"): print("---------------------------------------------------------") print("You have found the Jade Statue and have completed your quest!") # Exit loop at the end of game exit_inp = input("Do you want to continue? Y/N ") if exit_inp.lower() == ("n"): return [False, 5] else: return [True, 0] elif last_inp.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif last_inp[0:4].lower() == ("take"): return [True, 5, items.pick_up(last_inp[5:], 5)] elif last_inp[0:8].lower() == ("put down"): if last_inp[9:].lower() in itemList: items.put_down(last_inp[9:], 5) return [True, 5] else: return [True, 5] else: print("---------------------------------------------------------") return [True, 4]
def EastLoop(grating_inp, itemList): if grating_inp.lower() == ("go south"): if items.useItem('longsword', itemList): print("---------------------------------------------------------") print("You killed the ogre") print("You are entering the cave he was guarding") return [True, 5] else: print("You see a large ogre and turn around.") return [True, 3] elif grating_inp.lower() == ("descend grating"): return [True, 4] elif grating_inp[0:4].lower() == ("take"): return [True, 3, items.pick_up(grating_inp[5:], 3)] elif grating_inp.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif grating_inp[0:8].lower() == ("put down"): if grating_inp[9:].lower() in itemList: items.put_down(grating_inp[9:], 3) return [True, 3] else: return [True, 3] else: print("---------------------------------------------------------") return [True, 3]
def SouthwestLoop(forest_inp, itemsList): if forest_inp.lower() == ("go west"): print("---------------------------------------------------------") print("You would need a machete to go further west.") return [True, 2] elif forest_inp.lower() == ("go north"): print("---------------------------------------------------------") print("The forest becomes impenetrable to the North.") return [True, 2] elif forest_inp.lower() == ("go south"): print("---------------------------------------------------------") print("Storm-tossed trees block your way.") return [True, 2] elif forest_inp.lower() == ("go east"): return [True, 3] elif forest_inp[0:4].lower() == ("take"): return [True, 2, items.pick_up(forest_inp[5:], 2)] elif forest_inp.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif forest_inp[0:8].lower() == ("put down"): if forest_inp[9:].lower() in itemList: items.put_down(forest_inp[9:], 2) return [True, 2] else: return [True, 2] else: print("---------------------------------------------------------") return [True, 2]
def Field(second, itemList): if second.lower() == ("take mailbox"): print("---------------------------------------------------------") print("It is securely anchored.") return [True, 0] elif second.lower() == ("open mailbox"): print("---------------------------------------------------------") print("Opening the small mailbox reveals a leaflet.") return [True, 0] elif second[0:4].lower() == ("take"): return [True, 0, items.pick_up(second[5:], 0)] elif second.lower() == ("go north"): return [True, 1] elif second.lower() == ("open door"): print("---------------------------------------------------------") print("The door cannot be opened.") return [True, 0] elif second.lower() == ("take boards"): print("---------------------------------------------------------") print("The boards are securely fastened.") return [True, 0] elif second.lower() == ("look at house"): print("---------------------------------------------------------") print( "The house is a beautiful colonial house which is painted white. It is clear that the owners must have been extremely wealthy." ) return [True, 0] elif second.lower() == ("go east"): print("---------------------------------------------------------") print("You walk around to the back of the house") return [True, 6] elif second.lower() == ("go southwest"): return [True, 2] elif second.lower() == ("read leaflet"): if items.useItem('leaflet', itemList): print("---------------------------------------------------------") print( "Welcome to the Unofficial Python Version of Zork. Your mission is to find a Jade Statue." ) return [True, 0] else: return [True, 0] elif second.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif second[0:8].lower() == ("put down"): if second[9:].lower() in itemList: items.put_down(second[9:], 0) return [True, 0] else: return [True, 0] else: print("---------------------------------------------------------") return [True, 0]
def ArmoryRoom(armory_inp, itemList): if armory_inp.lower() == ("go south"): return [True, 1] elif armory_inp.lower() == ("take longsword"): print("---------------------------------------------------------") print("You take the longsword") return [True, 11, items.pick_up('longsword', 11)] elif armory_inp.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif armory_inp[0:4].lower() == ("take"): return [True, 11, items.pick_up(armory_inp[5:], 11)] elif armory_inp[0:8].lower() == ("put down"): if armory_inp[9:].lower() in itemList: items.put_down(armory_inp[9:], 11) return [True, 11] else: return [True, 11] else: print("---------------------------------------------------------") return [True, 11]
def GratingLoop(cave_inp, itemList): if cave_inp.lower() == ("descend staircase"): return [True, 5] elif cave_inp.lower() == ("take skeleton"): print("---------------------------------------------------------") print("Why would you do that? Are you some sort of sicko?") return [True, 4] elif cave_inp.lower() == ("smash skeleton"): print("---------------------------------------------------------") print("Sick person. Have some respect mate.") return [True, 4] elif cave_inp.lower() == ("light up room"): if items.useItem("lantern", itemList): print("---------------------------------------------------------") print("You light up the room and see runes on the walls.") print("They are unintelligible") return [True, 4] else: print("---------------------------------------------------------") print("You would need a torch or lamp to do that.") return [True, 4] elif cave_inp.lower() == ("break skeleton"): print("---------------------------------------------------------") print("I have two questions: Why and With What?") return [True, 4] elif cave_inp.lower() == ("go down staircase"): return [True, 5] elif cave_inp.lower() == ("go south"): return [True, 9] elif cave_inp.lower() == ("scale staircase"): return [True, 5] elif cave_inp[0:4].lower() == ("take"): return [True, 4, items.pick_up(cave_inp[5:], 4)] elif cave_inp.lower() == ("kick the bucket"): print("---------------------------------------------------------") print("You die.") print("---------------------------------------------------------") return [False, 0] elif cave_inp[0:8].lower() == ("put down"): if cave_inp[9:].lower() in itemList: items.put_down(cave_inp[9:], 4) return [True, 4] else: return [True, 4] else: print("---------------------------------------------------------") return [True, 4]
def attic(attic_inp): status = 'alive' room_num = 13 if attic_inp.lower() == 'go down': room_num = 12 elif attic_inp.lower().startswith("put down"): item = items.put_down(attic_inp[9:], 13) my_item_list.remove(item) elif attic_inp.lower().startswith("pick up"): item = items.pick_up(attic_inp[8:], 13) my_item_list.append(item) elif attic_inp.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status
def end_of_game(last_inp): status = 'alive' room_num = 11 if last_inp.lower() == ("open trunk"): print("---------------------------------------------------------") print("You have found the Jade Statue and have completed your quest!") elif last_inp.lower().startswith("put down"): item = items.put_down(last_inp[9:], 11) my_item_list.remove(item) elif last_inp.lower().startswith("pick up"): item = items.pick_up(last_inp[8:], 11) my_item_list.append(item) elif last_inp.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status
def maze_entrance(maze_inp): status = 'alive' room_num = 15 if maze_inp.lower() == 'enter cave': room_num = 10 elif maze_inp.lower() == 'go south': room_num = 16 elif maze_inp.lower().startswith("put down"): item = items.put_down(maze_inp[9:], 10) my_item_list.remove(item) elif maze_inp.lower().startswith("pick up"): item = items.pick_up(maze_inp[8:], 10) my_item_list.append(item) elif maze_inp.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status
def kitchen(kitchen_inp): status = 'alive' room_num = 12 if kitchen_inp.lower() == "go up": room_num = 13 elif kitchen_inp.lower() == "go east": room_num = 14 elif kitchen_inp.lower().startswith("put down"): item = items.put_down(kitchen_inp[9:], 12) my_item_list.remove(item) elif kitchen_inp.lower().startswith("pick up"): item = items.pick_up(kitchen_inp[8:], 12) my_item_list.append(item) elif kitchen_inp.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status
def front_of_house(second): status = 'alive' room_num = 4 if second.lower() == ("take mailbox"): print("---------------------------------------------------------") print("It is securely anchored.") elif second.lower() == ("open mailbox"): print("---------------------------------------------------------") print("Opening the small mailbox reveals a leaflet.") elif second.lower() == ("go north"): room_num = 1 elif second.lower() == ("open door"): print("---------------------------------------------------------") print("The door cannot be opened.") elif second.lower() == ("take boards"): print("---------------------------------------------------------") print("The boards are securely fastened.") elif second.lower() == ("look at house"): print("---------------------------------------------------------") print( "The house is a beautiful colonial house which is painted white. It is clear that the owners must have been extremely wealthy." ) elif second.lower() == ("go southwest"): room_num = 8 elif second.lower() == 'go east': room_num = 14 elif second.lower() == ("read leaflet"): print("---------------------------------------------------------") print( "Welcome to the Unofficial Python Version of Zork. Your mission is to find a Jade Statue." ) elif second.lower().startswith("put down"): item = items.put_down(second[9:], 4) my_item_list.remove(item) elif second.lower().startswith("pick up"): item = items.pick_up(second[8:], 4) my_item_list.append(item) elif second.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status
def east_loop_and_grating(grating_inp): status = 'alive' room_num = 9 if grating_inp.lower() == ("go south"): print("---------------------------------------------------------") print("You see a large ogre and turn around.") elif grating_inp.lower() == ("descend grating"): room_num = 10 elif grating_inp.lower().startswith("put down"): item = items.put_down(grating_inp[9:], 9) my_item_list.remove(item) elif grating_inp.lower().startswith("pick up"): item = items.pick_up(grating_inp[8:], 9) my_item_list.append(item) elif grating_inp.lower() == ("kick the bucket"): status = 'dead' else: print("---------------------------------------------------------") return room_num, status