Tuesday, May 06, 2008

Programming as Art, Literally

D078FCE5-0720-4BC0-A495-1BD8E0AD8FE9.jpgThis is one of the strangest things I've seen. Piet is a programming language in which programs look like abstract paintings. At right is the Hello World program.

"The basic unit of Piet code is the colour block. A colour block is a contiguous block of any number of codels of one colour, bounded by blocks of other colours or by the edge of the program graphic. Blocks of colour adjacent only diagonally are not considered contiguous. A colour block may be any shape and may have "holes" of other colours inside it, which are not considered part of the block...Each non-black, non-white colour block in a Piet program represents an integer equal to the number of codels in that block."

7A8A5FD7-4538-4CE4-BEDA-68BA21D5A1AC.jpgThe language was designed to produce code modeled on the art of Piet Mondrian. This program actually looks like a Piet painting and it prints "Piet". Here are other examples including impressive programs that do prime number tests and generators. There are several versions of some of the programs, each trying to be more artistic. The Pi generator is most impressive, "Richard Mitton supplies this amazing program which calculates an approximation of pi... literally by dividing a circular area by the radius twice."

2 comments:

Anonymous said...

This reminds me of "programming" ICs using polysilicon layout. Except that was in three dimensions.

Anonymous said...

Hmm... I think I know now what to occupy my product manager with...