Life is a Mystery
photo of the woods

Evolving Mona Lisa

/ 09 December 2008

Take semi-transparent polygons of this sort…

Picture 5.png

…and write an algorithm to arrange them so that they build up an imitation of another picture. If you could only use 50 polygons, how close could you get to Mona Lisa? Here’s how Roger Alsing approached the probelm with “genetic programming”:

I created a small program that keeps a string of DNA for polygon rendering.

The procedure of the program is quite simple:

  1. Setup a random DNA string (application start)

  2. Copy the current DNA sequence and mutate it slightly

  3. Use the new DNA to render polygons onto a canvas

  4. Compare the canvas to the source image

  5. If the new painting looks more like the source image than the previous painting did, then overwrite the current DNA with the new DNA

  6. repeat from 1

Take a look at his result, 904,314 generations later. More at Slashdot.