Question: This is for a simplified version of a text-based game. You will focus on displaying how a room dictionary works with the move commands. This
This is for a simplified version of a text-based game. You will focus on displaying how a room dictionary works with the move commands. This will include the if, else, and elif statements that move the adventurer from one room to another.
First, use this dictionary and map to help guide you in your game (map attached):
#A dictionary for the simplified dragon text game #The dictionary links a room to other rooms. rooms = { 'Great Hall': {'South': 'Bedroom'}, 'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'}, 'Cellar': {'West': 'Bedroom'} } |

Next, you will develop code to meet the required functionality, by prompting the player to enter commands to move between the rooms or exit the game. To achieve this, you must develop the following:
- A gameplay loop that includes:
- Output that displays the room the player is currently in
- Decision branching that tells the game how to handle the different commands. The commands can be to either move between rooms (such as go North, South, East, or West) or exit.
- If the player enters a valid move command, the game should use the dictionary to move them into the new room.
- If the player enters exit, the game should set their room to a room called exit.
- If the player enters an invalid command, the game should output an error message to the player (input validation).
- A way to end the gameplay loop once the player is in the exit room.
Great Hall North South East Bedroom Cellar West
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
