Question
Before beginning this milestone, it is important to understand the required functionality for this simplified version of the game. The game should prompt the player
Before beginning this milestone, it is important to understand the required functionality for this simplified version of the game. The game should prompt the player to enter commands to either move between rooms or exit the game. Review the Milestone Simplified Dragon Text Game Video and the Milestone Simplified Text Game Flowchart to see an example of the simplified version of the game. A video transcript is available: Transcript for Milestone Simplified Dragon Text Game Video. IMPORTANT: The Move Between Rooms process in the Milestone Simplified Text Game Flowchart is intentionally vague. You designed a more detailed flowchart or pseudocode for this process as a part of your work on Project One. Think about how your design will fit into this larger flowchart. In PyCharm, create a new code file titled ModuleSixMilestone.py. At the top of the file, include a comment with your name. As you develop your code, you must use industry standard best practices, including in-line comments and appropriate naming conventions, to enhance the readability and maintainability of the code. Next, copy the following dictionary into your PY file. This dictionary links rooms to one another and will be used to store all possible moves per room, in order to properly validate player commands (input). This will allow the player to move only between rooms that are linked. Note: For this milestone, you are being given a dictionary and map for a simplified version of the dragon-themed game. Make sure to read the code carefully so that you understand how it works. In Project Two, you will create your own dictionary based on your designs. #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'} } A portion of the map for the Dragon Text Game showing the Great Hall, Bedroom, and Cellar, with arrows indicating the directions the player can move between them. The Cellar is to the East of the Bedroom, which is to the South of the Great Hall. 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 TIP: Use the pseudocode or flowchart that you designed in Step #4 of Project One to help you develop your code. As you develop, you should debug your code to minimize errors and enhance functionality. After you have developed all of your code, be sure to run the code to test and make sure it is working correctly. What happens if the player enters a valid direction? Does the game move them to the correct room? What happens if the player enters an invalid direction? Does the game provide the correct output? Can the player exit the game? I'm stuck and I'm wanting to pull my hair out at this point. I wrote some code for the milestone assignment. I can get it to work moving from the starting room, Great Hall, going south to the Bedroom, but when I try to go East to the Cellar, I get the invalid output. Then when I try to exit the game, it stops running and doesn't give the exit game output. What am I missing?? ``` # A dictionary for the simplified text game that links a room to other rooms. # The dictionary links a room to other rooms import time rooms = { 'Great Hall': {'South': 'Bedroom'}, 'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'}, 'Cellar': {'West': 'Bedroom'} } position = 'Great Hall' time.sleep(1) print('You are at the starting location: The Great Hall') time.sleep(2) while True: direction = input('Please enter direction to move (East/West/North/South) or Quit to quit: ') if direction == 'Quit': break if direction in rooms[position]: print("You have reached the " + rooms[position][direction]) elif rooms == 'Quit': print('Thanks for playing! Try again if you wish!') break else: print(" Sorry, no path in that direction!")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started