/
vehicle.py
79 lines (63 loc) · 2.09 KB
/
vehicle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from dice import Dice
class Vehicle(object):
def __init__(self):
self.vehicle_dice = Dice()
self.name = "Vehicle"
self.distance = 0
def run(self):
self.distance += self.vehicle_dice.get_value()
def get_distance(self):
return self.distance
#switched true to false and vice versa
class Car(Vehicle):
def __init__(self):
self.car_dice = Dice()
self.car_dice1 = Dice()
self.car_dice2 = Dice()
self.name = "Car"
#self.distance = 0
self.position = 0
def run(self):
# self.distance += self.car_dice.get_value()
# self.distance += self.car_dice1.get_value()
# self.distance += self.car_dice2.get_value()
space = self.car_dice.get_value()
# + self.car_dice1.get_value() + self.car_dice2.get_value()
return space
# def set_position(position):
# self.position = position
# def get_position():
# return self.position
class Motorcycle(Vehicle):
def __init__(self):
self.motor_dice = Dice()
self.motor_dice1 = Dice()
self.name = "Motorcycle"
#self.distance = 0
self.position = 0
def run(self):
# self.distance += self.motor_dice.get_value()
# self.distance += self.motor_dice1.get_value()
space = self.motor_dice.get_value()
# + self.car_dice1.get_value() + self.car_dice2.get_value()
return space
# def set_position(position):
# self.position = position
# def get_position():
# return self.position
class Bike(Vehicle):
def __init__(self):
self.bike_dice = Dice()
self.name = "Bike"
#self.distance = 0
self.position = 0
def run(self):
# self.distance += self.motor_dice.get_value()
# self.distance += self.motor_dice1.get_value()
space = self.bike_dice.get_value()
# + self.car_dice1.get_value() + self.car_dice2.get_value()
return space
# def set_position(position):
# self.position = position
# def get_position():
# return self.position