Stephen Wolfram’s book, “A New Kind of Science” is flippin’ brilliant! (or perhaps I'm just not brilliant enough to realize he's a mad man) 1,280 pages packed with beautiful insights and Tufte-worthy visualizations. I remember discovering it while randomly browsing the MS library one day. I became so enthralled, an hour passed just standing there reading it!  [I should also plug his excellent TED talk]

Just one of the bazillions of wonderful things covered is this simplest possible universal Turing machine. It was proved to be the lower limit on Turing machine universality by Alex Smith in 2007.

The tape head can be in one of two states (up/down) and the tape position may be one of three colors (white/yellow/orange). Of course, Alan Turing’s original allowed an unspecified finite number of states and symbols. The rules for Wolfram’s 2,3 machine are:

For example, the first rule says when in the up state and pointing at orange, then paint yellow, remain up and move to the left. On the other hand, if conditions are the same but in the down state (4th rule) then paint white and move to the right. Starting with a blank (white) tape it produces the following sequence of tape states (nice animation here):

Here’s a quick F# implimentation:

open System.Drawing
open System.Windows.Forms

let w = 200
let h = 1000
let b = new Bitmap(w, h)

let tape = Array.create w 0
let rec machine head state y =
let rules = function
| 1, 2 -> 1, 1, –1
| 1, 1 -> 1, 2, –1
| 1, 0 -> 2, 1, 1
| 2, 2 -> 1, 0, 1
| 2, 1 -> 2, 2, 1
| 2, 0 -> 1, 2, –1
let state', color, offset = rules (state, tape.[head])