Modified version of the Berlin Clock Kata presented here.


Problem Description

A Berlin ClockThe Berlin Clock (Mengenlehreclock or Berlin Uhr) is a clock that tells the time using a series of illuminated colored blocks, as you can see in the picture on the right.

The top lamp blinks to show seconds - it is illuminated on even seconds and off on odd second.

The next two rows represent hours. The upper row represents 5 hour blocks and is made up of 4 red lamps. The lower row represents 1 hour blocks and is also made up of 4 red lamps.

The final two rows represent the minutes. The upper row represents 5 minute blocks, and is made up of 11 lamps - every third lamp is red, the rest are yellow. The bottom row represents 1 minute blocks, and is made up of 4 yellow lamps.

What we want is textual Berlin Clock that gets updated in real time. The textual representation can be something like this.

          O
  R    R     R    R
  R    R     R    O
Y Y R Y Y R Y Y R Y Y
  Y    Y     Y    Y
The above text is the representation for 23:59:59. "0" represents a lamp that is off, "R" a red lamp that is on, "Y" a yellow lamp that is on. Look here for more examples.

Last modified: Tuesday, 15 January 2019, 5:33 PM