Genetic algorithms have got to be one of the crazier ideas in computer science – take an initial population and cross-breed/mutate to create the next generation. It doesn’t always find the optimal solution, but it sure tries hard and is fun to watch!
Python 3 code here.