Conway's Game of Life in Processing
Shortcuts to the demonstration:
Game of Life (source)
Processing
If you haven't used
processing, you should spend some time with it. It lowers the bar for 2D and 3D graphics programming without significantly restricting your creativity or flexibility. In addition to what you'll find below, here are some
beautiful examples of what's possible, complete with source code.
Conway's Game of Life - the introduction
Conway's Game of Life is a cellular automaton. Consider an MxN array of living cells. A cell can neither live alone nor in too large a crowd. Cells in healthy neighborhoods are born. With each generation (iteration), the health of the neighborhood is calculated and cells survive, perish or are born accordingly.
Conway's rules are thus:
- Live cells with less than two neighbors die.
- Live cells with more than three neighbors die.
- Live cells with two or three neighbors survive.
- Dead cells with three neighbors are born.
These simple rules, when applied to an initial state, have surprisingly complex results. Wikipedia has a
good introduction, including examples of stable constructs, oscillating constructs and oscillating and moving constructs. Try building these constructs in the
demo and seeing for yourself.
Other curious constructs
5 cell horizontal line
Starting with a 5 cell horizontal line, the games evolves into four blinkers.
5 cells evolving into 4 blinkers
10 cell horizontal line
Starting with a 10 cell horziontal line, the game immediately evolves into a 15 cycle oscillator.
Iteration 1.
Iteration 2.
Iteration 3.
Iterations 3 - 17, looped.
Don't settle for my pictures,
try it yourself:
Game of Life (source)
17 Oct 09 - jjguy -
jjg@jjguy.com