Genetic algorithm by example