Piet: Turing-complete abstract art

Piet was named for Piet Mondrian, and its programs look like Mondrian paintings -- which makes Mondrian Turing-complete. (Shown above: a Piet "Hello World" program.)

It was invented by David Morgan-Mar as part of an esoteric programming language project, and took on a life of its own with "a small community of coders writing Piet programs, interpreters, IDEs, and even compilers."

The Piet language interpreter begins executing a program in the colour block which includes the upper left codel of the program. The interpreter maintains a Direction Pointer (DP), initially pointing to the right. The DP may point either right, left, down or up. The interpreter also maintains a Codel Chooser (CC), initially pointing left. The CC may point either left or right. The directions of the DP and CC will often change during program execution.

As it executes the program, the interpreter traverses the colour blocks of the program under the following rules:

* The interpreter finds the edge of the current colour block which is furthest in the direction of the DP. (This edge may be disjoint if the block is of a complex shape.)

* The interpreter finds the codel of the current colour block on that edge which is furthest to the CC's direction of the DP's direction of travel. (Visualise this as standing on the program and walking in the direction of the DP; see table at right.)

* The interpreter travels from that codel into the colour block containing the codel immediately in the direction of the DP.

* The interpreter continues doing this until the program terminates.

Piet

[David Morgan-Mar/Dangermouse]

(via JWZ)

Loading...