conway's game of life
description
I programmed Conway's Game of Life when I was 15 as a quick summer project; it took me three hours to plan and finish developing, but it was a milestone in my programming ability because it gave me a deeper passion for simple-yet-elegant algorithms and rule sets.
The Game of Life works like this: on a 2-dimensional grid, a cell can be either alive (black) or dead (white). The keys to the system are the rules that govern which cells deserve to be alive and which do not after every generation, and the rules are in terms of each of the cells' eight neighbouring cells.
John Conway was not the first to come up with this premise, but his rules were the first to behave with consistent complexity, and they have even been proven to be capable of simulating other data-manipulation rule sets; Conway's Game of Life is Turing-Complete.
Now, here are the rules that govern the cells through each generation:
any dead cell with three live neighbours becomes alive,
any live cell with two or three live neighbours remains alive, and
any other cell remains — or becomes — dead.
With these rules, there are so many possibilities! I've included two below, in case you are interested in how this game actually pans out.
gosper glider gun
This system of cells creates gliders, the smallest form of spaceships, which are groups of cells that march indefinitely in any direction. The Gosper Glider Gun was created in an effort to prove that there was a continually reproducing life form somewhere in Conway's life rules.
acorn
Starting from only seven cells, the acorn takes 5206 generations to create 568 stable, live cells and 13 escaped gliders (which end up as squares on the edge in my version)! At this simulation rate, it should take a minute for the whole life to unfold, and then it will repeat.