Assignment - Locations For this assignment, we will be creating our location class and then a few locations to subclass from it. Most of these classes will be rather short so you can put them all in locations.py if you would like Create the Location class Create the Town class Create the Palace and Lumbermill classes Location Class The Location class establishes the basic properties of a location: manager - holds the character that manages the location foreColor - holds the fore color of the location backColor - holds the back color of the location Enter() - default method for entering a location. By default, the manager should greet you and all text displayed should use the foreColor and backColor of the location. Exit() - default method for leaving a location. By default, the manager should say bye to you and all text displayed should use the foreColor and backColor of the location. Upkeep() - default method that is called when time is advanced Town Class The Town class will inherit from the Location class and will contain all our locations:
Assignment - Locations
For this assignment, we will be creating our location class and then a few locations to subclass from it. Most of these classes will be rather short so you can put them all in locations.py if you would like
Create the Location class
Create the Town class
Create the Palace and Lumbermill classes
Location Class
The Location class establishes the basic properties of a location:
manager - holds the character that manages the location
foreColor - holds the fore color of the location
backColor - holds the back color of the location
Enter() - default method for entering a location. By default, the manager should greet you and all text displayed should use the foreColor and backColor of the location.
Exit() - default method for leaving a location. By default, the manager should say bye to you and all text displayed should use the foreColor and backColor of the location.
Upkeep() - default method that is called when time is advanced
Town Class
The Town class will inherit from the Location class and will contain all our locations:
palace - create a Palace location and store it here
lumbermill - create a Lumbermill location and store it here
Enter() - Print a menu for all the locations available. Call the Enter() method of the appropriate location. Also, display the current date (see below)
Exit() - If you leave the town, it should exit the program.
Upkeep() - Trigger the upkeep method of all locations
Palace class
The Palace class will inherit from the Location class.
Give option to deposit gold (add some gold to your Player when generating). Show currently deposited gold when inside the palace
Give an option to rest. After rest, trigger the upkeep of all locations.
The manager of the palace is the player.
You should not greet yourself when entering or exiting...
Lumbermill class
The Lumbermill class will inherit from the Location class.
add the following properties
rate - this is wood per day
capacity - this is max wood you can hold
stock - this is the current amount of wood you have
Enter() - As well as greeting you, the screen should also display rate, capacity and stock.
Upkeep() - This should add the value of rate to your stock. Do not exceed capacity
Displaying the date - I decided on a system where we will follow the seasons and advacing time will advance 1 week. We will start on Week 1 of Spring. Everytime the player rests, it should advance 1 week. After 13 weeks, reset back to 1 and advance the season.
To bring this all together, you should create a player and then have them Enter() the Town.
Zip your python files and submit.

Due to complexity of the question we have attempted a partial answer to your question outlining the important aspects of the requirements - namely, the Location, Town and Palace classes. The code for the same is given below:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images









