Conway’s Game of Life

The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It crossed my mind a couple of months ago so I wrote a quick and dirty implementation in C# one evening. It’s interesting because it has the power of a universal Turing machine which means that The Game of Life is theoretically as powerful as any computer with unlimited memory and no time constraints. Essentially anything that can be computed algorithmically can be computed within Conway’s Game of Life. It’s also quite mesmerizing.

Rules (ripped straight from Wikipedia)

The universe of the Game of Life is a two-dimensional grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbors, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

  • Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overcrowding.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Screencast showing simple interactions causing complex results

Code available (C# project VS 2012 Express) through Github if you want to screw around with it.

https://github.com/WrathZA/ConwaysGameOfLife

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
This entry was posted in Code. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.