The class Vehicle

The class Vehicle which represents a vehicle in the system is very simple. Its role is only to keep track of when the vehicle was created and where it is heading.

The destination is provided as a parameter for the init method (constructor) while the born time needs to be fetched with get_time() in the downloaded module wallclock.py.

The class can be illustrated with this class diagram: bild
A vehicle does not need to know its own location, not look at lights, nor look for other vehicles. The vehicles can be seens as a token being moved by "someone else".

Back

Valid CSS!