These images represent four steps in one computer program's progress towards recreating the Mona Lisa using only 50 semi-transparent polygons. Swedish programmer Roger Alsing did this simple weekend project with genetic programming that resulted in a program that could generate, on its own, a pretty awesome likeness of the famous painting. So how did he do it?

He wrote a program that would randomly place shapes on a black background, and decide whether the abstract pattern looked more or less like the famous painting. After almost a million tries, the program's output had evolved to the point where Alsing had the image on the far right.


How does this simple program work? Alsing explains:

The procedure of the program is quite simple:

0) Setup a random DNA string (application start)

1) Copy the current DNA sequence and mutate it slightly
2) Use the new DNA to render polygons onto a canvas
3) Compare the canvas to the source image
4) If the new painting looks more like the source image than the previous painting did, then overwrite the current DNA with the new DNA
5) repeat from 1


He also includes source code for those who wish to delve further. Though he's had some debate with commenters on his blog as to whether this counts as pure evolutionary programming, he argues that it is because the program has to mutate each time it finds an image that's closer to the Mona Lisa. Luckily Sarah Connor isn't around, because she'd have this guy's ass in a sling.

Genetic Programming: Evolution of Mona Lisa [via Roger Alsing's Blog]