Shows a set of traffic lights at an intersection. Designed to work with multiple types of intersections, but the example is based on a 4-way cross-intersection.
Clone repository and install dependancies. Requires Node
(tested with Node 6.x)
$ git clone git@github.com:rogchap/traffic-lights.git
$ cd traffic-lights
$ npm i
$ node traffic-lights
To see all available options run the help
$ node traffic-lights -h
The program is designed to run in two formats:
start
will output a visual of a cross-intersection.simulate
will "dump" an output of states over a given time
start
(default):
simulate
:
You can change the interval time and the time on amber with flags -i
and -a
;
for example to have an interval of 5 minutes with 30 seconds at amber:
$ node traffic-lights -i 300 -a 30
To simulate an output over 30 minutes, use the time (-t
) flag with simulate
:
$ node traffic-lights simulate -i 300 -a 30 -t 1800
$ npm test