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: vehiclepy Attributes: name vehicles name, initial vehicles initial, minspeed minimum value of speed range, maxspeed 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: initself name, initial, minspeed, maxspeed set the attributes using the parameters, assign to position and to energy. fastself dist passes in the distance to the next obstacle if there is one If there is sufficient energy randomize a value between min and max speed for the number of spaces they will move and deduct 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 slowself 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 applicablestrself return a string with the vehicles name, position, and energy. Abstract methods: descriptionstringself and specialmoveself dist are overridden by the subclasses. Use a decorator to make them abstract Car Class inherits from Vehicle in a separate file named: carpyinitself calls the superclasss init with values for name Lightning Car initial C minspeed and maxspeed descriptionstringself returns a string with the cars stats and abilities. specialmoveself dist passes in the distance to the next obstacle if there is one If there is sufficient energy deduct energy and move the car at x 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: motorcyclepyinitself calls the superclasss init with values for name Swift Bike initial M minspeed and maxspeed slowself dist overridden method passes in distance to the next obstacle if there is one The motorcycle will move at 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 descriptionstringself returns a string with the motorcycles stats and abilities. specialmoveself dist passes in distance to the next obstacle if there is one If there is sufficient energy deduct energy, then there is a chance that the motorcycle will move at x 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: truckpyinitself calls the superclasss init with values for name Behemoth Truck initial T minspeed and maxspeed descriptionstringself returns a string with the trucks stats and abilities. specialmoveself dist passes in the distance to the next obstacle if there is one If there is sufficient energy deduct energy and move the truck x 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: mainpy Construct a D list that stores the track. It should have three lanes, one for each vehicle and should be 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
