Question: def show _ instruction ( ) : print ( ' Welcome Player' ) print ( ' You woke up in a hospital alone. You need
def showinstruction:
printWelcome Player'
printYou woke up in a hospital alone. You need to find items in the nine rooms.
printThere is a mutant zombie in one the rooms so be weary.
printMove commands: North, East, South, West'
printAdd to Inventory: Get Items'
print
def showstatus:
printfYou are in the currentroom
printfInventory: inventory
printYou look around and see', roomscurrentroomitem
rooms
'Bathroom': East: 'Room Six', 'item': 'Shoes'
'Room Six': West: 'Bathroom', 'South': 'Hallway', 'item': 'Clothes'
'Hallway': North: 'Room Six', 'East': 'Backdoor Room 'South': 'Staircase', West': Front Room', 'item': 'Gun'
'Front Room': East: Hallway', 'item': 'Backpack'
'Backdoor Room': West: 'Hallway', 'North': 'Morgue Room', 'item': 'Parking Lot key'
'Morgue Room': South: Backdoor Room', 'item': 'Car Key'
'Staircase': North: 'Hallway', 'East': 'Basement', 'item': 'Extra bullets'
'Basement': West: 'Staircase', 'East': 'Parking Lot', 'item': 'Canned food and water'
'Parking Lot': West: 'Basement', 'item': 'Mutant Zombie'
def getnewstatedirectionfromuser, currentroom :
newlocation currentroom
if directionfromuser in roomscurrentroom:
newlocation roomscurrentroomdirectionfromuser
else:
printYou hit the wall. Try again'
return newlocation
showinstruction
currentroom 'Room Six'
inventory
while True:
showstatus
directionfromuser inputEnter a command' title
if directionfromuser in North 'East', 'South', 'West':
newlocation getnewstatedirectionfromuser,currentroom
currentroom newlocation
elif directionfromuser Get roomscurrentroomitem:
if roomscurrentroomitem not in inventory:
inventory.appendroomscurrentroomitem
printYou picked up and put in your inventory'.formatroomscurrentroomitem
else:
printItem already picked up
elif currentroom 'Parking Lot':
printCONGRATULATION You successfully got the items, beat the Mutant Zombie, and got out of the hospital'
break
else:
printInvalid
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
