I’ve been in lock-down, stuck living and working in a “bubble” at home, so I went with the hardware I had and simply re-programmed my FlipClock project (a 480x320 LCD shield, a Uno and a shield between them with buttons and an RTC). I drastically cut-down that sketch to have just this one face, no date, no DLS, etc. Kept it simple because I wanted to finish it in April. Other than the time, configuration is compile-time.
The Life algorithm is something I dredged up from my memory of implementations past. It’s low memory at 1-bit per cell (plus an overhead) and one pass, so it’s fast and works on a Uno with only 2k SRAM. It uses bit manipulation and a three-row rolling buffer. Neighbour counts come from the buffer, meaning updates can go direct to the field. This lends itself well to interesting colour effects. This is after all a “65535 colour” LCD so it would be a shame to have a monochrome display (although that is an option, for the purists).
- The game runs on a field that wraps around, but can be configured to have “sterile” edges instead.
- Cells born in a particular generation have a random colour. An alternative scheme is births flash red, deaths blue and surviving cells are white. Or just black & white.
- The time is shown in 24 hour mode.
The choice of preferences is made by #defines. There are some font choices too.
It’s fast and colourful. I rarely tire of seeing a Life population evolve. There’s always something to see, with the added dramatic tension of wondering if that furball of cells will go somewhere interesting before the time ticks over to the next minute.
Some screen captures showing the default 24-hour mode, wrapped edges and random colours:
The power-on screen showing the splash screen and current time, 16:36 pm
A little while later, the splash screen gliders have evolved, eating away at the other text.
A minute later, 16:37. 16:36’s gliders are evolving.
And another minute later
The alternative colour scheme, red births, blue deaths: