I reminded myself of Piet again

Published Nov 29, 2020

Ever since I heard about Piet, I’ve wanted to write draw a program in it. It’d be really cool to paint or print the program in real life. It’s the closest I’ll ever be to visual art! There are two things that kept me from actually trying it.

First, this is a low-level language. You’re writing instructions for the stack interpreter directly, and there’s no obvious way to create abstractions. This language really needs an IDE (and there are a few!), because how am I really going to refactor a painting without help?

Second, I get confused by the fact that instructions are encoded by changes to lightness and hue. That sounds like coding in the “second derivative” of the program I want instead of the program itself. Maybe that goes away with practice, but it was enough to keep me away.

I wonder what it’d be like to use fixed color values as data types or instructions. That would severely reduce the flexibility in representation though, and a design feature of Piet is that you can express yourself with your color choices. To get that back, there could be a prefix block that sets up interpretation of the rest of the program, like the Unicode BOM or a map legend. I imagine that each author-artist would eventually end up with a “signature” setup block (or a small collection) as an expression of their style.