GeneticLeonardo is a program that "evolves" drawings. The chromosomes encode the position, shape and color of 50 polygons. The fittest chromosomes are those who produce images most like a given image.
The goal is to approximate any image with only 50 polygons.
Here's how it works:
Generate a random population of chromosomes
Produce images by interpreting these chromosomes
Select the chromosomes that produce the best images
Mate the best chromosomes by exchanging information
Mutate the new chromosomes slightly
Kill the worst ranked chromosomes
Repeat from step 2 until satisfied
An executable version can be downloaded from:
You are more than welcome to contribute to this project! There is room for a lot of improvement.
The code is released as Open Source under the BSD license.
A zip of the source code is available at:
A zip of an earlier version which uses Genetic Programming is available too:
Note that the GP version doesn't converge very well yet.
The most important classes are:
gd.gui.EvolutionRunnable: Class in charge of actually running the evolution process.
gd.core.GAConfiguration: Encapsulates the settings of the genetic algorithm.
gd.core.GAInitialChromosomeFactory: Creates a suitable initial chromosome.
gd.core.GAPhenotypeExpresser: Class that can interpret the information encoded in the chromosomes.
gd.core.LMSFitnessFunction: Computes the fitness of a program as the Least-Mean-Sqare distance between the image it generates and the target image.