Tuse makyt\ApPpbat \ProgramS \Python sers/maky C/py Akhenaten is one of the most feared pharaohs of Egypt and he is ready to take over the world. You as the Medjay have to prevent Akhenaten from taking over the world by gathering all of the artifacts to banish him from the land of the living. You will be traveling through each portal throughout ancient Egypt to prevent him from accomplishing his goal. You will be transported to one of these ancient Egypt locations based on your decision of movement of North, East, South, West. The locations that you will be traveling throughout are the Nile, Pyramids of Giza, Cairo, Karnak, Abydos Temple, Hamuaptra, Am-shere, and Alexandria. The artifacts that you will be needing to collect are: Canopic jars, The book of the dead, amulet, a Sarcophagus, Short Swords, and Scarabs. Whith the artifacts that you collect you are able to banishing him, from the land of the living and preventing resurrection. You are in the Alexandria. Inventory: [] You see a
Step by step
Solved in 2 steps
This is the code I keep getting several errors. I don't know what I am doing wrong it has to move from room to room pick up items and stay in inventory.
rooms = {'Alexandria': {'name':'Alexandria','South': 'Nile', 'North': 'Pyramids of Giza', 'East': 'Abydos Temple', 'West': 'Am-shere', 'text':'Alexandria'},
'Nile': {'name':'Nile', 'North': 'Alexandria', 'East': 'Karnak', 'item': 'Amulet', 'text':'Nile'},
'Am-shere': {'name':'Am-shere','East': 'Alexandria', 'item': 'Canopic jars', 'text':'Am-shere'},
'Karnak': {'name': 'Karnak','West': 'Nile', 'item': 'Akhenaten', 'text':'Karnak'},
'Abydos temple': {'name':'Abydos temple','West': 'Alexandria', 'North': 'Cairo', 'item': 'Scarabs', 'text':'Abydos temple'},
'Cairo': {'name': 'Cairo','South': 'Abydos Temple', 'item': 'Sarcophagus', 'text':'Cairo'},
'Pyramids of Giza': {'name':'Pyramids of Giza', 'South': 'Alexandria', 'East': 'Hamuantra', 'item': 'Short Swords', 'text':'Pyramids of Giza'},
'Hamuantra': {'name':'Hamuantra', 'West': 'Pyramids of Giza', 'item': 'The Book of the Dead', 'text':'Hamuantra'}}
item = { 'Nile': 'Amulet', 'Amshere': 'Canopic jars','Karnak': 'Akhenaten', 'Abydos temple': 'Scarabs','Cairo': 'Sarcophagus','Pyramids of Giza': 'Short Swords', 'Hamuantra': 'The Book of the Dead',}
text = { 'Alexandria': 'You have just entered into a portal and you are in Alexandria.\n There is no item in this location.',
'Nile': 'You have just entered into a portal and now you are in the Nile.\n There is the amulet it over by the tomb.',
'Am-shere': 'You have just entered into a portal and now you are in Am-shere.\n There is the Canopic jars it is the chest near the treasure.',
'Karnak': 'You have just entered into a portal and now you are in Karnak.\n I hope you have collected all 6 items to defeat Akhenaten.',
'Abydos temple': 'You have just entered into a portal and now you are in Abydos Temple.\n Look at the wall there some Scarabs quick grab some.',
'Cairo': 'You have just entered into a portal and now you are in Cairo.\n We have to look around and see if we can find a Sarcophagus.\n Found one quickly grab it and lets set it up for the ritual.\n',
'Pyramids of Giza': 'You have just entered into a portal and now you are in Pyramids of Giza.\n Lets hurry and look around for any weapons that have been left.\n Wait! I see one near that Sarcophagus its a Short Sword.\n',
'Hamuantra': 'You have just entered into a portal and now you are in Hamuantra.\n We have to look for the goddess basset the the book of the dead is burried beneath her.\n I see her near the entrance lets get to work and grab it.\n',}
instructions = ( 'Akhenaten is one of the most feared pharaohs of Egypt and he is ready to take over the world.\n' 'You will be traveling through each portal throughout ancient Egypt to prevent him from accomplishing his goal.\n''You will be transported to one of these ancient Egypt locations based on your decision of movement of\n North, East, South, West.\n''The locations that you will be traveling throughout are the Nile, Pyramids of Giza, Cairo, Karnak,\nAbydos Temple, Hamuaptra, Am-shere, and Alexandria.\n''The artifacts that you will be needing to collect are:\nCanopic jars,The book of the dead, amulet, a Sarcophagus, Short Swords,and Scarabs.\n''Whith the artifacts that you collect you are able to banishing him,\n from the land of the living and preventing resurrection.\n')
directions = ['North', 'South', 'East', 'West']
pick_up_items = ['The Book of the Dead', 'Short Swords', 'Sarcophagus', 'Scarabs', 'Canopic jars', 'Amulet', 'Akhenaten']
print(instructions)
current_room = 'Alexandria'
item_in_room = 'None'
inventory = []
while True:
if inventory == [item]:
print('Congratulations! You collected all the items, you are ready for Karnak')
elif current_room == 'karnak':
print('You have collected all of the items!. That are needed to send Akhenaten back to the underworld!')
print('A bolt of magic streaks towards you and your vision goes black..... Game Over!')
break
print('You are in the {}.'.format(current_room))
print('Inventory:', inventory)
if item_in_room: #checks to see if there is an item in the room
print('You see a'.format(item_in_room))
else:
print("You don't see anything useful")
command = input('\nEgypt locations:\n Which portal would you like? (North, East, South, West.)')
if command in directions:
if command in rooms[current_room].keys():
command = command.split()[1]
current_room = rooms[current_room[command]]
else:
print('You cant go that way!')
if command in pick_up_items:
command = command.split()[1]
if command in rooms[current_room].keys():
inventory.append(current_room['item'])
else:
print('You cant get that item here!')
if command == 'quit':
print('Thanks for playing!')
break
else:
print('Invalid input')