This program slowly changes the position and colour of shapes to make them look more like a target image
using a generic algorithm.
Fitness is calculated by checking every single pixel in the 900x600 image and taking the mean Euclidian
distance between the colours the pixels in the current image and their target colour in 3D RGB colour space.
A genetic algorithm is used to minimize this fitness value.
- Genotype are the triangles that make up the image (position + colour)
- Phenotype is the image after superimposing all the triangles together
At each generation, we do the following:
- Select two genotypes at random from population
- Perform crossover on their triangles using 1 split point to create child
- Slightly mutate attributes of triangles in child (position & colour)
- If chance prevails, add or remove a triangle from child
- If the child is better, replace the worse performing parent in population with child