Four way intersection

!jtc Programming Group September Programming Challenge

In C, write a simulation of cars entering and passing through a four way intersection.

Input: average rate of arrival of cars in any direction (e.g. 1 car in 3 time intervals).

Graphic output:

For each time unit, show with simple ASCII graphic characters the intersection, the 4 two way streets (allow up to 5 cars in any single lane on any single side of the intersection) and the cars.


1. A car at an intersection can procede through it only if there is no car on its right. In this simulation cars only go straight through the intersection.

2. Cars advance 1 car length per time unit (simulation advances 1 time unit at a time).