Conway: Life and Death v1.1
I noticed my game of life app, Conway, had a couple of cosmetic bugs on newer versions of macOS so I spent a couple of hours fixing them up. While I was at it I couldn’t resist the urge to tinker and added an option for cells to leave trails, which I think makes the app very pretty!
I originally wrote the app as a tribute to John Conway. It’s no longer available on the Mac App Store but you can download it as a zipped app instead. (Warning: the binary has not been notarized so you’ll need to proceed at your own risk by following Apple’s instructions for running unnotarized softare.)
Adding trails was an interesting technical diversion.
Each cell in the universe is stored as an unsigned 8-bit integer in a texture, meaning it can have 256 different values. The original version of Conway used 0 for “dead”, and 1, 2, or 3 for “alive”. Each alive value was assigned a different colour, but were equivalent for the purposes of running the simulation.
This meant I still had 252 other values I could use for each cell, which just happens to divide nicely by 3, the number of colours each theme supports. I invented a new “zombie” state for each colour which is defined as dead for the purposes of simulation, but acts as a countdown from fully alive to fully dead.
| Cell value | Definition |
|---|---|
| 0 | dead |
| 1–84 | zombie |
| 85 | alive |
| 86–169 | zombie |
| 170 | alive |
| 171–254 | zombie |
| 255 | alive |
When each generation is updated, the zombie cells decrement until they reach fully dead. To show the fading trails, zombie cells are rendered as a blend between the background colour and their assigned alive colour depending upon how dead they are.