blogphotosbookshire me

Game of Life Visualisations

01 July 2015

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.

Stats Are Random

When stats are random, it ends up creating weird looking results after a few dozens frames. Here are these results:

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.

Read the comments or contribute with your own