This is an evolutionary AI artist: instead of a trained neural network, a population of candidate "paintings" — each a fixed list of semi-transparent colored triangles (its genome) — competes to resemble a hidden target image under a genetic algorithm.
fitness(g) = 1 − mean_pixels( |render(g) − target|² ) / 3
selection : keep top 50% of population by fitness (elitism)
crossover : child genes = randomly interleaved genes from two parents
mutation : with prob. p, perturb a gene's position, size, color or alpha
next gen : elites + crossover children, repeat
Each generation: every genome is rendered to an offscreen canvas the same size as the target, compared pixel-by-pixel (mean squared color error) to get a fitness score, the best half survive unchanged (elitism — the champion's DNA is never lost), and the rest of the population is refilled by breeding pairs of survivors with crossover, then mutating a fraction of genes. Over hundreds of generations the population's best individual converges toward a rough painterly likeness of the target, purely from selection pressure and random variation — no gradients, no backpropagation, no training data.
- Population size — more candidates explore more of the "painting space" per generation, at higher render cost.
- Mutation rate — probability each gene is perturbed when a child is created; too low stalls progress, too high destroys good solutions.
- Genes (triangles) — how many triangles make up a genome; more genes can capture finer detail but slows convergence.
- Fitness strip — the thin bar under the canvases plots the best-fitness trend over recent generations.