Many electronic devices have digital read-outs that are made using light-emitting diode (LED) arrays. A common digital display element uses seven, bar-shaped LED's, with the seven LED bars (segments) arranged and identified as:
Digits are displayed by illuminating various combinations of the seven segments in accordance with the following table:
Digit Segments Illuminated (Y-Yes, N-No)
Displayed a b c d e f g
0 Y Y Y Y Y Y N
1 N Y Y N N N N
2 Y Y N Y Y N Y
3 Y Y Y Y N N Y
4 N Y Y N N Y Y
5 Y N Y Y N Y Y
6 Y N Y Y Y Y Y
7 Y Y Y N N N N
8 Y Y Y Y Y Y Y
9 Y Y Y Y N Y Y
For example, the digit three (3) would be displayed as the illumination of the segments {a,b,c,d,g} as:
The problem below is abstracted from one occurring in the incoming-parts inspection department, in a microwave-oven manufacturing facility. The incoming seven-segment LED's are checked for their proper functioning by automated equipment running under programmable control.
Note: The solution to the problem below will not be a complete nor necessarily useful test for the actual inspections that would be conducted.
You are to create a program that will observe successive sets of illumination conditions of the seven segments of a single-digit display, and decide whether the sequence of illuminations could have been a valid ``count down" sequence.
Unfortunately, for the LED your program is to observe, some of the segments may be burned out at the start of your test, and additional segments may burn out during the test. No segments will everfail into the ON mode; no burned out segments will recover. Nevertheless, you are expected to be able to ``read" through the ambiguities this malfunctioning display presents, by watching the display count down through one or more values.