It seems like a rather simple algorithm to check if the traffic lights on a given intersection is set in a wrong/dangerous/conflicting way. Why is it not done?<p>Long story: I had a traffic an ugly traffic accident the last Friday. The area is new, all the traffic light equipment was installed recently. I had a green left arrow, so I was turning left. Three cars in front of me in the same left turning lane, one behind me. So I am sure I had the green arrow and also I am sure it was there when I was entering the intersection. Suddenly, there was a car approaching me going straight from the opposite direction. There was no time to avoid, just hit brakes and pray.<p>The girl driving the other car told me she had a green light too, going straight. I could not believe. So, I went to the intersection yesterday and watched lights. I had seen it: straight in one direction and green left arrow in the opposite direction overlapping for almost a minute.<p>I called the police to report the traffic hazard.<p>They did not sound surprised at all. I am assuming that there is a lot of software involved in traffic light control nowadays. Obviously, there are three independent inadequacies: (1) software that allows programming traffic lights in a dangerous way, (2) software that controls traffic lights and (3) the person who did the setup. Why is it not done the right way?
While it should not be possible for the software to decide to turn on a conflicting configuration of lights, it is possible that something was mis-wired or mis-configured (consistently between the monitor and the control system, if it was in fact set up the way it <i>should</i> be, per lexicalscope's comment) such that the monitor and control system were not aware that that configuration of lights was dangerous. There is nothing inherent to the physical configuration of wires and colored glass that will mean "left arrow on side B" to a microcontroller.
I've heard various things about how this software is written, but in short generally there should be failsafes. I don't know where you live - but I know where I live at least a buddy that worked on writing the control software told me they have a hardware module that basically shuts down the computer controlling the light if two "conflicting" green instructions are to be sent - and sets the light into the flashing red all stop condition.<p>I have heard, never asked my buddy to check honestly because I never thought much of it, that prolog and various other logic languages are used to do some of the traffic light control work. As I said - I'm not sure if that's true, but if so, it would certainly make sense, and should make these kind of cases near impossible to get into.