website articles
the game of life - 1998
Conway's Game of Life is probably one of the most famous algorithms ever. Mathematicians and computer scientists have been deeply attracted by it because it's incredibly simple to describe and code (it's not even 20 lines of code), yet it produces amazingly complex patterns. In fact, it can reproduce a variety of structures than grow, move, die, and reproduce themselfs. It was theorized that life could actually emerge from this algorithm, in the sense of selfreplicating structures. The truth is that the game of life has been studied and structures build such that all sort of functional structures grow, like clocks, logical gates, counters and so on, what allows at least to build computers within the universe of the game itslef.

You can probably read about Conway's Game of Life in many places, but in short, it goes like this: you have a 2d grid of booleans values, for example, 1024x1024. Each cell in the grid can be dead (0) or alive (1). Now, we will execute one iteration (on generation) and the state of each cell will change depending on it's current state and the state of the cells around it. There are some simple rules that drive the process: if a cell is alive and there is two or three of the eight surounding cells are alive, then keep alive, otherwise die. If the cell is already dead, but three of the eight neighbour cells are alive, then the cell comes to life. Once all the cells of the grid have been updated, we have a new generation and we can start again. The process repeats for ever, and so the patterns of zeros and ones evolve, forming structures and so on. You need two buffers for this of course, one where you have the current generation of cells and another one where you are going to compute the new one. You don't need to memcpy() any buffer, just use the right one when you want to display the results on screen, you can ping pong the process.

The life algorithm was used back in 2001 in one 64 kilobyte demo
 ```*... *.*. **.. ``` ```.*.. ***. *.** ``` ```.**.**. .**.**. ..*.*.. *.*.*.* *.*.*.* **...** ``` ```*..*. ....* *...* .**** ```