-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastfeet.py
executable file
·67 lines (42 loc) · 1.24 KB
/
fastfeet.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
#!/usr/bin/env python
from datetime import date
from bike import SchedulableMixin
class Trip(object):
def __init__(self):
self.bicycles = []
self.customers = []
self.vehicle = None
def prepare(self, preparers):
for preparer in preparers:
preparer.prepare_trip(self)
class Vehicle(SchedulableMixin, object):
def lead_days(self):
return 3
class Mechanic(SchedulableMixin, object):
def prepare_trip(self, trip):
for bicycle in trip.bicycles:
self.prepare_bicycle(bicycle)
def prepare_bicycle(self, bicycle):
pass
def lead_days(self):
return 4
class TripCoordinator(object):
def prepare_trip(self, trip):
self.buy_food(trip.customers)
def buy_food(self, customers):
pass
class Driver(object):
def prepare_trip(self, trip):
self.fuel_up(trip.vehicle)
self.fill_water_tank(trip.vehicle)
def fuel_up(self, vehicle):
pass
def fill_water_tank(self, vehicle):
pass
if __name__ == '__main__':
starting = date(2015, 9, 4)
ending = date(2015, 9, 10)
v = Vehicle()
v.is_schedulable(starting, ending)
m = Mechanic()
m.is_schedulable(starting, ending)