In real life, natural selection's primary goal is the continuation of the species, and organisms that achieve that goal tend to be propagated. For example, a simple fitness function might interpret the genes of an organism as the value of x in a complicated equation. The natural-selection process could then be tuned to prefer organisms that generate an output near zero, so that the survivors would eventually produce a solution to the equation. A complete genetic algorithm is too complex for a CS 70 assignment, but we can implement some of the core functions relatively easily. Mutation involves selecting a gene site and modifying it in some fashion, usually by replacing it with another gene.
Mutation is very rare both in real life and in genetic algorithms.
Recombination is the most important process in generating new organisms. Real genetic algorithms usually generate two children in this process, and may splice at more than one point, but we'll simplify things in our implementation. The final step, selection, will not be implemented in this assignment. As in real life, there is some randomness, so that a somewhat unfit organism has a chance of surviving even when a more fit one is discarded. Because we will not have time to implement an entire genetic algorithm, we will limit ourselves to the recombination and mutation functions.