This challenge is in honor of the tacky Christmas lights at my in laws' house.
The challenge is to create a graphical output showing the decoration in "real time".
The video (gif or other format) will have n-by-m vertical and horizontal "lights". 5 <= m,n <= 40. The frame size and resolution may vary dependent on n and m, but must be at least 50x50 pixels for n,m=5 (vector graphics is OK). A picture with
m=5 will look something like this:
All lights will have one of the following 6 RGB-colors
mwill be taken as input on any reasonable format and in the order you like
- The image will change every
dt = 25 ms. Deviations are OK if it's due to "outside factors" such as limitation in the interpreter, slow computer etc.
- If it's impossible to set the time step manually, then the default time step is accepted.
- All lights will be red (
- There's always a 5% chance that the first light (top-left) will change color. All colors (except the color it currently has) should be equally likely.
Each light (except the first) will get the color of the light to its left. If the light is at the far left then it will get the color of the light on the far right on the row above. The lights are numbered as shown below. Light number
kwill get the color of the light number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
The output should in theory run for ever (unless your language / interpreter has some limitation that prevents this).
- Please provide a sample of at least 5 seconds, preferably more in the answer (this is an encouragement, not a requirement). (A link to TIO or similar is of course OK too :D )
- Frames, axes, grid lines etc are accepted.