Skip to content

Turing Drawings

December 31, 2012

After watching a documentary about Alan Turing, I started thinking about Turing machines again. They’re a very useful tool for computer science proofs and an elegantly simple computational model. Beyond this, however, Turing machines seem relatively useless in terms of “real-world” applications. Any computable function can be computed by a Turing machine, but you probably wouldn’t want to use one as a compilation target: it would be too inefficient.

One possible application for Turing machines is to use them as programs to generate data procedurally. Their simplicity makes it possible, for example, to create working programs randomly. Generating a random stream of x86 instructions that doesn’t crash could be tricky, but with a Turing machine, it’s quite easy. I decided to try something like this to produce so-called generative art. The program I wrote generates random Turing machines that operate on a two-dimensional grid instead of a one-dimensional tape. The symbols written on the grid can be interpreted as colors, and voilà: we have procedural drawings.

I prototyped this in JavaScript and named the project Turing Drawings. This is available on GitHub if you’re interested in seeing the source code. Better yet, I put a live demo up on GitHub pages (first time trying gh-pages, works great!) and I started collecting a list of interesting patterns produced by Turing Drawings:

Last night, by chance, I randomly generated something that looked very much like the Sierpinski fractal, but unfortunately lost the encoding for that one. If you happen to find fractal patterns, be sure to let me know!

EDIT: seems the people on have gotten pretty excited about this. I’m surprised at how much of a positive response I got. Here are some of the nicest patterns they’ve found:

For future work, I’m thinking it might be interesting to try using Turing machines to generate music procedurally. Certainly, music could be represented by notes on a tape, or even multiple tapes.

  1. This takes two minutes two walk over the canvas. First I thought it would never progress, but leaving it running long enough shows it slowly advances to the right.,3,3,1,3,2,1,2,3,2,1,3,1,1,3,1,0,2,2,1,0,1,3,1,1,3,2,1,3,1,1,3,0,1,1,3,2,0

    Surprisingly, the behavior looks slightly different in this fork, because it starts in the middle instead of the left side:,3,3,1,3,2,1,2,3,2,1,3,1,1,3,1,0,2,2,1,0,1,3,1,1,3,2,1,3,1,1,3,0,1,1,3,2,0

    And this mutation is even slower. It starts building noise, and the noise slowly grows to the right. Looks like it is computing or calculating some number, because the left side changes way more often than the right side, and the right side grows very very slowly.,3,3,1,3,2,1,2,3,2,1,3,1,1,3,1,0,2,2,1,0,1,3,1,1,3,0,1,3,1,1,3,0,1,1,3,2,0

    And this one just builds a brick wall:,3,0,2,0,0,1,1,3,2,3,0,1,3,0,2,1,3,1,0,0,1,1,1,2,0,1,1,0,3,1,1,2,2,1,2,2,3

Trackbacks & Pingbacks

  1. Dibujos hechos a partir del concepto de máquinas de Turing [ENG]
  2. More Fun with Turing Machines « Pointers Gone Wild
  3. Turing Drawings ∴ HODGE
  4. Nerdcore › Turing Drawing Machines
  5. Turing Drawings Followup | Pointers Gone Wild
  6. Generate Turing Drawings & Turing Tunes - ikono
  7. Dogfooding Higgs with the Turing Turtle | Pointers Gone Wild

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: