@@ 43-56 (lines=14) @@ | ||
40 | ||
41 | print("\nStep 2 - Moving scooters . . . . . . . .") |
|
42 | ||
43 | while time.time() <= end_time: |
|
44 | count = 0 |
|
45 | ||
46 | while count < len(self._scooter_id): |
|
47 | data = self.api.get_scooter_data(self._scooter_id[count]) |
|
48 | ||
49 | self.scooter.add_scooter_to_dict(data) |
|
50 | self.scooter.add_city_to_dict(self._city_data[count]) |
|
51 | self.scooter.set_station_id(self._station_id[count]) |
|
52 | ||
53 | count = self.run(count) |
|
54 | ||
55 | count += 1 |
|
56 | time.sleep(0.003) |
|
57 | ||
58 | ||
59 | def run(self, count: int) -> int: |
|
@@ 117-126 (lines=10) @@ | ||
114 | print("\nStep 3 - Returning scooters . . . . . . . .") |
|
115 | print("\nThe simulation has finished, the scooters will be returned.\n") |
|
116 | ||
117 | while count < len(self._scooter_id): |
|
118 | data = self.api.get_scooter_data(self._scooter_id[count]) |
|
119 | ||
120 | self.scooter.add_scooter_to_dict(data) |
|
121 | self.scooter.add_city_to_dict(self._city_data[count]) |
|
122 | self.scooter.set_station_id(self._station_id[count]) |
|
123 | self.end(count) |
|
124 | ||
125 | count += 1 |
|
126 | time.sleep(0.003) |
|
127 | ||
128 | ||
129 | def main(self, total:int): |