Question: Vehicle Class Abstract class - ( in a separate file named: vehicle . py ) Attributes: _ name vehicle s name, _ initial vehicle s

Vehicle Class Abstract class -(in a separate file named: vehicle.py) Attributes: _name vehicles name, _initial vehicles initial, _min_speed minimum value of speed range, _max_speed maximum value of speed range, _position the vehicles current location on the track, _energy vehicles power level. Use decorators to create the properties for the initial, the position, and energy attributes. Methods: 1.__init__(self, name, initial, min_speed, max_speed) set the attributes using the parameters, assign 0 to position and 100 to energy. 2. fast(self, dist) passes in the distance to the next obstacle (if there is one). If there is sufficient energy (>=5), randomize a value between min and max speed for the number of spaces they will move and deduct 5 energy. If that movement is less than the distance to the next obstacle, then they move that amount, otherwise, it crashes into the obstacle and stops in the space just before the obstacle. Return a string that describes the event that occurred with the name of the vehicle and the distance traveled (if applicable).3. slow(self, dist) passes in the distance to the next obstacle (if there is one). The vehicle will move at half speed. If there is an obstacle, then it will go around it. There is no energy cost. Return a string that describes the event that occurred with the name of the vehicle and the distance traveled (if applicable).4.__str__(self) return a string with the vehicles name, position, and energy. 5. Abstract methods: description_string(self) and special_move(self, dist) are overridden by the subclasses. Use a decorator to make them abstract. Car Class inherits from Vehicle (in a separate file named: car.py)1.__init__(self) calls the superclasss init with values for name (Lightning Car), initial (C), min_speed (6), and max_speed (8).2. description_string(self) returns a string with the cars stats and abilities. 3. special_move(self, dist) passes in the distance to the next obstacle (if there is one). If there is sufficient energy (>=15), deduct 15 energy and move the car at 1.5x speed. If there is an obstacle, then it will crash and stops in the space just before it, otherwise it moves the randomized distance. Return a string that describes the event that occurred with the name of the car and the distance traveled (if applicable). Motorcycle Class inherits from Vehicle (in a separate file named: motorcycle.py)1.__init__(self) calls the superclasss init with values for name (Swift Bike), initial (M), min_speed (6), and max_speed (8).2. slow(self, dist) overridden method - passes in distance to the next obstacle (if there is one). The motorcycle will move at 75% speed, rather than half. If theres an obstacle, then it will go around it. There is no energy cost. Return a string that describes the event that occurred with the name of the motorcycle and the distance traveled (if applicable).3. description_string(self) returns a string with the motorcycles stats and abilities. 4. special_move(self, dist) passes in distance to the next obstacle (if there is one). If there is sufficient energy (>=15), deduct 15 energy, then there is a 75% chance that the motorcycle will move at 2x speed, otherwise it will crash and only move one space forward. If it was successful but there is an obstacle, then it will crash and stops in the space just before it, otherwise it moves the randomized distance. Return a string that describes the event that occurred with the name of the motorcycle and the distance traveled (if applicable). Truck Class inherits from Vehicle (in a separate file named: truck.py)1.__init__(self) calls the superclasss init with values for name (Behemoth Truck), initial (T), min_speed (4), and max_speed (8).2. description_string(self) returns a string with the trucks stats and abilities. 3. special_move(self, dist) passes in the distance to the next obstacle (if there is one). If there is sufficient energy (>=15), deduct 15 energy and move the truck 2x speed, even if there is an obstacle (ram bashes through the obstacle). Return a string that describes the event that occurred with the name of the truck and the distance traveled (if applicable). Main (in a separate file named: main.py) Construct a 2D list that stores the track. It should have three lanes, one for each vehicle and should be 100 units long. Randomly place two obstacles in each lane, but dont place them at the start or finish. Construct a list of the three vehicle objects. Display the descriptions for each of the vehicles and prompt the user to choose one to play as, the other two will become the opponents. Have a loop that repeats until all three vehicles have reached the finish. On each iteration, display the track and the three vehicles. Then prompt the user to move fast, slow, or to do their special move and call the corresponding method based on what they chose. The oppone

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!