Question: Needs to be solved in Python 3. Problem 1 - NetHack Redux (10 points) Your roommate is remaking the old dungeon-exploration game NetHack. NetHack originally
Needs to be solved in Python 3. 
Problem 1 - NetHack Redux (10 points) Your roommate is remaking the old dungeon-exploration game NetHack. NetHack originally used ASCII graphics to depict the map. They understand that in games, you must store state in some manner in between turns or moves. They need to write a function that displays an ASCII character-style map based on variables that contain information about where items in the game are located To display the map, they need to know things like how big it is, where the walls are, and where objects (doors, items, players) are. For this problem, your roommate has chosen to keep track of this information in the following ways: Wall locations are stored as a tuple of (row, column) tuples. If the variable representing the wall locations contains a coordinate pair, a wall is in that location. Walls appear as "#" characters in the displayed map .Objects are stored as a list of tuples where each tuple contains another tuple (the (row, column) location of the object) and the ASCII character that represents that object on the map. C'd") represents doors, ("s"represents secret doors, ("%") represents objects of interest, and ("S") represents treasure . The player location is stored as a (row, column) tuple. The player appears as an"@" character in the displayed map In order to see the map, your roommate wrote a function named display_room) that has five parameters: the height of the room, the width of the room, the wall locations, the objects in the room, and the player location. Their function should print the appropriate characters at each location of the map, and any location that isn't otherwise assigned a character is represented by a "." The problem is that their function isn't working correctly. They're certain that it's correct, but apparently they missed a few lessons on lists. Help them fix the problem in their function. They've provided their incorrect code and a valid, instructor provided, doctest below def display_room (height, width, walls, objects, player) >>> walls= ((0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (1, 0), (1, 7), >>> obj s= [((3, 0), 'd'), ((5, 4), 'd'), ((3, >>> player= (3, 1) >display_room (6, 8, walls, objs, player) 6), 'S'), ((4, 6), 'S'), ((2, 3), '%')] row ['. ' for w in range (width)] room grid [row for h in range (height)] for wall in walls r, c= wall room-grid [r] [c] '#' for obj in objects r, c= obj [0] room grid [r] [c] obj [1] room grid [player [0]] [player [1]] '@' - Eor row in room_grid print'-join (ow))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
