Question: Python Roleplay game. You will develop your code in these files: [ main . py , adventure _ map.py , inventory.py , item.py , room.py
Python Roleplay game. You will develop your code in these files: mainpy adventuremap.py inventory.py item.py room.py roomnotfounderror.py
The provided template includes main.py which initializes all of the objects required for the game. Also included are the empty files to code your Classes in
You mustuse methods. You mustuse classes. You must use modules. You mustuse file IO You mustuse custom exceptions. All files must be present to pass the autograder.
room.py
It is initialized in main
It has a name, a description, multiple exits, and multiple items
item.py
It is initialized in main
It has a name, a description, and an item content
roomnotfounderror.py
It is thrown when navigating to a room that does not exist, or that is not in the current list of exits
You need to raise the exception in a tryexcept block and when caught, you need to print out the message of the error like this: Invalid Room: ballroom Room not found
When roomnotfound error is raised, the turn counter is still incremented.
When the error is triggered, the user then is prompted for a new action.
adventuremap.py
It is initialized in the main
It is a map of all of the rooms
inventory.py
It is initialized in main
It is a list of the items that you have picked up
main.py
Keep a count of how many actions it took until the player finished the game. Export this number to gamelog.txt with each successful game run.
Exit:
Allow the player to exit a room using a predefined command, like "exit."
When the player chooses to exit, see which exit they want to go to Throw a room not found error if their choice is invalid.
Look Around:
This action allows the player to examine their current surroundings or room. When a player uses this action, provide a description of the room they are in including any items or objects of interest within it
You will associate this action with a simple command like "look around."
If there are more than item, you like them with commas separating them like this: You find some items around you: Fork, Pizza Cutter.
Inventory:
The inventory action allows the player to view the items they have collected so far. When the player uses this action, list the items in their inventory along with their descriptions.
This action will be triggered using a command like "inventory."
Pickup:
When the player wants to pick up an item that is present in the current room, they can use the "pickup" action.
Check if items in the current room can be picked up If there are, allow the player to pick up the first item mentioned in the look around command. Once picked up add the item to the player's inventory and remove it from the room.
Provide feedback to the player about what they have picked up
If there are no items to pickup, print There are not items to pick up Yes there is a typo in the autograder.
Read:
Some items in your game can be readable, like books, notes, or scrolls. Implement an action that allows the player to read such items.
When the player uses the "read" action on the book, display the content of that item.
Ensure that the player has the item in their inventory before allowing them to read it
If you do not have an item that can be read, you need to print out: I don't have anything to read
Play:
If your game has musical instruments or interactive objects, you can implement a "play" action.
When the player uses the "play" action on the harmonica, it triggers a specific response or interaction related to that item.
Ensure that the player possesses the required item in their inventory.
If you do not have an item that can be played, you need to print out: I don't have anything to play
Unlock:
Implement an "unlock" action for scenarios where the player needs to use a key or another object to unlock something, like a door or a chest.
When the player uses the "unlock" action, check if they have the key in their inventory. If they do trigger the unlocking of the relevant object and provide feedback to the player about their progress.
If you do not have an item that can be unlocked, you need to print out: I don't have anything to unlock
Inspect:
The "inspect" action can be used for closely examining items or objects in the game world, revealing additional information or story details.
When the player uses the "inspect" action on an inspectable item, provide a more detailed description or backstory related to that item.
If you do not have an item that can be inspected, you need to print out: I don't have anything to inspect
Victory condition: you have the key in the bedroom and escape through the trap door.
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
