Someone built a really fancy clock using Fibonacci numbers, which looks really nice but is fairly unusable. Just the way we like it! Let's recreate this.
The clock is made up of 5 sections corresponding to the first five Fibonacci numbers, starting from 1 (i.e. 1, 1, 2, 3, 5):
ccbeeeee
ccaeeeee
dddeeeee
dddeeeee
dddeeeee
The clock is capable of displaying the 12-hour time in increments of 5 minutes. Here is how that works. Consider the time 7:20. The hour 7 can be decomposed into the given Fibonacci numbers as
7 = 2 + 5
There are also 4 units of five minutes. The 4 can be decomposed as
4 = 2 + 1 + 1
Now the hours are shown in red, the minute chunks in green, and if a number is used for both hours and minutes it's shown in blue. If a number isn't used at all, it remains white. So the above would be shown as:
BBGRRRRR
BBGRRRRR
WWWRRRRR
WWWRRRRR
WWWRRRRR
But wait, there's more. The above decompositions aren't the only possibilities. One can also write 7 = 3 + 2 + 1 + 1
and 4 = 3 + 1
, which would give one of
GGRWWWWW GGBWWWWW
GGBWWWWW GGRWWWWW
BBBWWWWW or BBBWWWWW
BBBWWWWW BBBWWWWW
BBBWWWWW BBBWWWWW
depending on which 1
is chosen. Of course there are other combinations as well. The clock chooses from all valid decompositions at random.
As I said... this might not win a usability award, but it sure is nice to look at.
The Challenge
Your task is to implement such a clock. Your program (or function) should print an ASCII representation of the current time (rounded down to the last multiple of 5 minutes) as described above to STDOUT or closest alternative. You may choose to read the time in any common format as input or obtain it with standard library functions. You must not assume that the current/given time is divisible by 5 minutes.
Your solution must choose randomly from all possible representations of the current time. That is each representation must be printed with non-zero probability.
Midnight and noon should be treated as 0:00
(as opposed to 12:00
).
You may optionally print a single trailing newline character.
You may use any four distinct printable ASCII characters (character codes 0x20 to 0xFE) in place of RGBW
. Please state your choice in your answer and use it consistently.
This is code golf, so the shortest answer (in bytes) wins.