Question: Moving Between Rooms In this assignment, you will create a simplified version of a text - based adventure game where players can move between rooms

Moving Between Rooms
In this assignment, you will create a simplified version of a text-based adventure game where players can move between rooms using commands. Follow the instructions below to complete the assignment.
Task
You will need to create a dictionary linking rooms to each other so the player can move between them.
Below is a sample rooms dictionary, but you can feel free to get creative in your own code!
rooms ={
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
Develop code to meet the required functionality by prompting the player to enter commands to move between rooms or exit the game. You need to create a gameplay loop that includes:
Output that displays the current room the player is in.
Decision branching to handle different commands, such as moving between rooms (e.g.,"go North," "go South," "go East," "go West") or exiting the game.
If the player enters a valid "move" command, use the dictionary to move them to the new room.
If the player enters "exit," set their room to "exit" to end the game.
If the player enters an invalid command, provide an error message for input validation.
Remember: an invalid move can be both a case where there is no such direction or a case where the direction exists, but the player cannot move that way from his current room.
Create a way to end the gameplay loop when the player is in the "exit" room.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!