A few days ago I was on a plane for 6 hours and we only had a shared TV screen playing terrible sitcoms and movies. What do you do in this situation? Code some weird version of Conway’s Game of Life of course!
The Game
Rules
I didn’t follow the usual rules and instead decided to go with these:
- The board is randomly and entirely filled with “cells” on boot, representing the life forms
- Each cell have a given number of health points
- Each cell is part of a team
- Each cell will attack its neighbours if they are in another team
- Each cell will heal its neighbours if they are in the same team
- You can’t heal more than the maximum number of health points
- Once a cell reaches 0 life, it gets replaced by a new cell of the attacker’s team
- Each team has given attack, health and healing stats
- The board has a set height and width
For instance a Cell will have 100 health points, 10 attack, 2 healing and is part of team A. Meaning that any cell of team A next to it will be healed of 2 health points, and cell of team B next to it will loose 10 health points.
Visualisation
As for visualisation, I didn’t have internet so I just sticked with what I had: my terminal. The display choices were:
- Each team has a given color
- If a cell life’s is low, the color is lighter
- If a cell health goes below 10%, it goes black to show very contested zones
It took me a couple of hours to complete, and I find the result quite enjoyable to watch. The terminal colors gives the board a kind of Atari 2600 feel.
End Result
Everyone Has The Same Stats
When life, attack and healing stats are the same across teams, they usually quickly reach a stalemate. Sometimes, depending on how the board started a color might have some advantage. Because of the healing rule, we see highly contested borders, but no clear movement or winner.
![](/assets/misc/life/life_game.gif)
Stats Are Random
When stats are random, it ends up creating weird looking results after a few dozens frames. Here are these results:
![](/assets/misc/life/1.jpg)
![](/assets/misc/life/2.jpg)
![](/assets/misc/life/3.jpg)
![](/assets/misc/life/4.jpg)
![](/assets/misc/life/5.jpg)
![](/assets/misc/life/6.jpg)
![](/assets/misc/life/7.jpg)
![](/assets/misc/life/8.jpg)
![](/assets/misc/life/9.jpg)
![](/assets/misc/life/10.jpg)
![](/assets/misc/life/11.jpg)
![](/assets/misc/life/12.jpg)
![](/assets/misc/life/13.jpg)
![](/assets/misc/life/14.jpg)
![](/assets/misc/life/15.jpg)
![](/assets/misc/life/16.jpg)
![](/assets/misc/life/17.jpg)
![](/assets/misc/life/18.jpg)
![](/assets/misc/life/19.jpg)
![](/assets/misc/life/20.jpg)
![](/assets/misc/life/21.jpg)
![](/assets/misc/life/22.jpg)
![](/assets/misc/life/23.jpg)
![](/assets/misc/life/24.jpg)
Note On Code
I don’t think the code is worth sharing since it has been literally hacked together in two hours on a plane, but if you really really want to check it out, ping me on Twitter and I’ll send you the gist - it’s in Ruby.
Since you scrolled this far, you might be interested in some other things I wrote: