Klassen TrafficSystem
The class defines the components (lanes, signals and queues) that are part of a specific traffic system. The class needs to implement the following:
-
A constructor which creates the components.
-
A method
step()
, which advances all components by one step, moves vehicles
in or out of the system, past the lights and between lanes.
-
A method
snapshot()
that prints a snapshot of the system.
-
A method
number_in_system()
that returns the total number of vehicles currently in the system.
-
A method
print_statistics()
that prints out some statistics.
Tillbaka