from statistics import mean, median from time import sleep import destinations import trafficComponents as tc class TrafficSystem: """Defines a traffic system""" def __init__(self): """Initialize all components of the traffic system.""" self.time = 0 def snapshot(self): """Print a snap shot of the current state of the system.""" print(f'Time step {self.time}') def step(self): """Take one time step for all components.""" self.time += 1 def in_system(self): """Return the number of vehicles in the system.""" pass def print_statistics(self): """Print statistics about the run.""" pass def main(): ts = TrafficSystem() for i in range(100): ts.snapshot() ts.step() sleep(0.1) print('\nFinal state:') ts.snapshot() print() ts.print_statistics() if __name__ == '__main__': main()