Mondrian

When I was a feckless youth I enjoyed cellular automata and procedural generation more generally. One day I had a fun idea for an algorithm that would generate regions of colour separated by black lines, somewhat reminiscent of the art of Piet Mondrian1.

Because I was a feckless youth I had the time and energy to actually implement these silly little ideas. The code for the toy is on GitHub; it's a Windows screensaver.

The central idea, expressed imprecisely2, is this:

The original code was pretty terrible and had a few bugs. In March 2026 I thought I'd test out these fancy new models that were allegedly decent at programming now, so I pointed one at the code and asked it to modernise it and fix any bugs - it did a reasonable job4! Then I asked for a javascript version, which I now present to you below:

You'd have a running demonstration of the automaton here if you had javascript.


  1. Why Mondrian? I don't remember, precisely. I don't think I'd had any particular connection to his art before. My best guess is that it was an outgrowth of my interest in esoteric programming languages, via the language Piet5.↩︎

  2. The precise version is on GitHub :P.↩︎

  3. There are also some "coloured pixels" that are white; this leads to more white spaces with borders around them.↩︎

  4. I believe it was Opus 4.6. And yes, the code is still pretty ugly; poor old Claude was working with what it had. I assure you it's my fault in this case.↩︎

  5. For what it's worth I don't think Piet programs look much like Piet's art at all. But I don't have the art knowledge to suggest someone more fitting...↩︎