Question: class Location: A location in our text adventure game world. Instance Attributes: - # TODO Representation Invariants: - # TODO
class Location:
A location in our text adventure game world.
Instance Attributes:
# TODO
Representation Invariants:
# TODO
def initself briefdescription, longdescription, north, south, east, west None:
Initialize a new location.
# TODO Add more details here about the initialization if needed
self.briefdescription briefdescription
self.longdescription longdescription
self.north north
self.south south
self.east east
self.west west
# NOTES:
# Data that could be associated with each Location object:
# a position in the world map,
# a brief description,
# a long description,
# a list of available commandsdirections to move,
# items that are available in the location,
# and whether the location has been visited before.
# Store these as you see fit, using appropriate data types.
#
# This is just a suggested starter class for Location.
# You may changeadd parameters and the data available for each Location object as you see fit.
#
# The only thing you must NOT change is the name of this class: Location.
# All locations in your game MUST be represented as an instance of this class.
# TODO: Complete this method
def availableactionsself:
Return the available actions in this location.
The actions should depend on the items available in the location
and the xy position of this location on the world map.
# NOTE: This is just a suggested method
# ie You may removemodifyrename this as you like, and complete the
# function header eg add in parameters, complete the type contract as needed
# TODO: Complete this method, if you'd like or removereplace it if you're not using it
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
