This 1D cellular automaton is the simplest automaton to exhibit complex and unpredictable behaviour. Each cell is in one of two states. Cells transition between states based upon the states of themselves and their two neighbours in the previous generation:
As a programming example, this 70-line F# program uses Windows Forms to render a bitmap, handles GUI events in a functional style and uses pattern matching and higher-order functions to implement the cellular automaton itself.
This simple .NET program fills a window with generations of the rule 30 cellular automaton:
This example program is freely available in three forms: