-
Notifications
You must be signed in to change notification settings - Fork 1
/
driver.py
99 lines (78 loc) · 2.19 KB
/
driver.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
from location import Location, manhattan_distance
from rider import Rider
class Driver:
"""A driver for a ride-sharing service.
=== Attributes ===
@type id: str
A unique identifier for the driver.
@type location: Location
The current location of the driver.
@type is_idle: bool
A property that is True if the driver is idle and False otherwise.
"""
def __init__(self, identifier, location, speed):
"""Initialize a Driver.
@type self: Driver
@type identifier: str
@type location: Location
@type speed: int
@rtype: None
"""
# TODO
pass
def __str__(self):
"""Return a string representation.
@type self: Driver
@rtype: str
"""
# TODO
pass
def __eq__(self, other):
"""Return True if self equals other, and false otherwise.
@type self: Driver
@rtype: bool
"""
# TODO
pass
def get_travel_time(self, destination):
"""Return the time it will take to arrive at the destination,
rounded to the nearest integer.
@type self: Driver
@type destination: Location
@rtype: int
"""
# TODO
pass
def start_drive(self, location):
"""Start driving to the location and return the time the drive will take.
@type self: Driver
@type location: Location
@rtype: int
"""
# TODO
pass
def end_drive(self):
"""End the drive and arrive at the destination.
Precondition: self.destination is not None.
@type self: Driver
@rtype: None
"""
# TODO
pass
def start_ride(self, rider):
"""Start a ride and return the time the ride will take.
@type self: Driver
@type rider: Rider
@rtype: int
"""
# TODO
pass
def end_ride(self):
"""End the current ride, and arrive at the rider's destination.
Precondition: The driver has a rider.
Precondition: self.destination is not None.
@type self: Driver
@rtype: None
"""
# TODO
pass