I have made two examples of Code Art - taking a piece of code that does something and placing the text in such a manner that it conveys the idea of the program. The reason it sucks so much more than ASCII art is two-fold:

a. It is very hard to do significant touch-ups to the "art" - since the order of the characters is important (it's a program!)

b. You only have so many characters to play with. You need to gauge the needed size of the "art"

There are a few rules:

1. You cannot use comments as part of the "graphics" - every single character needs to be something that actually compiles.

2. You cannot create "nop" functions for filler. You can, in some cases, make things longer than they need to be. For example, if you have a "+2" somewhere, you can type "+ 1 + 1" if you need longer text. However, you should use that as a last resort.

3. You should not have "dead" code. Every piece of code that's in the art needs to be reachable (and should actually be reached where it makes sense).

Here are the screen-shots of the examples. The first is a program that calculates Pi to the 1000th character. If you cut and paste the code as is into Visual Studio, into a C# project, it will compile and show PI on a console window.

image

The following code shows the Bubble-sort algorithm:

image

(If you don't get it, these are 3 soap bubbles at the top and the plastic thing you use to create them at the bottom).

A download of both source files are attached to this post.