Do you know who Piet Mondrian is? The details of his life may not be familiar, but I bet you've come across one or two of his abstract works. Physicist and programmer David Morgan-Mar, better known by his nickname DangerMouse, decided to create a programming language inspired by Piet Mondrian's paintings, and the final result is "Piet". Each program is a colorful bitmap full of strange patterns, and despite its initial complexity, it has proven to be extremely flexible.

Piet: A Programming Language Whose Programs Look Like Paintings
01 - Hello World

In more than one occasion we've proven that a programming language doesn't always have to be "serious" or strict. Maybe you remember HeartForth, which basically uses emojis for its instructions, and then there's Rockstar, which follows a grammatical pattern similar to rock songs. The point is that with enough knowledge and a pinch of creativity, a language can become a real challenge for other programmers.

https://old.neoteo.com/befunge-el-lenguaje-de-programacion-mas-extrano/

The case of Piet, designed by David "DangerMouse" Morgan-Mar, is very particular. The programs don't end up as executables or other traditional resources, but they look a lot like the works of the Dutch artist Piet Mondrian. In essence, Piet uses 20 colors (six base colors multiplied by three shades, plus white and black), but judging by the patterns of some programs, there's a high degree of flexibility. In fact, there's no "official" interpreter per se, and Piet enthusiasts have followed its specification in different ways over time.

Piet found some popularity in the development of online puzzles. If you come across one of these programs, the official information should be enough to find a solution, or point you in the right direction. Next, we'll share some examples of programs made in Piet, and if you want to see more, here are additional samples.

Examples of Piet Programs

Among the examples, you'll find a program that counts beer bottles (referencing the 99 Bottles of Beer song), another that follows the Fizz Buzz game, and a special version of Conway's Game of Life.

Piet: A Programming Language Whose Programs Look Like Paintings
The original Piet Hello World
Piet: A Programming Language Whose Programs Look Like Paintings
This code generates the first 100 Fibonacci numbers
Piet: A Programming Language Whose Programs Look Like Paintings
A program designed to solve the classic Tower of Hanoi puzzle
Piet: A Programming Language Whose Programs Look Like Paintings
A more visually appealing Hello World variant, demonstrating the language's flexibility
Piet: A Programming Language Whose Programs Look Like Paintings
A prime number test. It takes a number and prints 'prime' or 'composite'.
Piet: A Programming Language Whose Programs Look Like Paintings
A small tribute to the painter. The program prints 'Piet', and is almost a replica of his works.
Piet: A Programming Language Whose Programs Look Like Paintings
Exactly what the title says. Its creator didn't explain much about how it works.
Piet: A Programming Language Whose Programs Look Like Paintings
A program that calculates an approximation of Pi, literally by dividing the area by the radius squared. A larger program would allow a more precise Pi...
Piet: A Programming Language Whose Programs Look Like Paintings
A program that helps count beer bottles (I guess it refers to the song...)
Piet: A Programming Language Whose Programs Look Like Paintings
Another Hello World, more aligned with the painter's style
Piet: A Programming Language Whose Programs Look Like Paintings
A calculator that determines the day of the week between the years 2000 and 2099. The result is expressed from 0 to 6 (0 = Sunday, 1 = Monday... up to 6 = Saturday).
Piet: A Programming Language Whose Programs Look Like Paintings
The first follows the famous Fizz Buzz game. The other is a text-based adventure.
Piet: A Programming Language Whose Programs Look Like Paintings
An interpreter for another esoteric language, Brainfuck
Piet: A Programming Language Whose Programs Look Like Paintings
A simple tribute. It prints 'Tetris', and each of the 'codels' mimics the pieces of the classic game.
Piet: A Programming Language Whose Programs Look Like Paintings
A special version of Conway's Game of Life