This interactive element demonstrates how evolution can allow agents to adapt through the process of mutation, selection, and inheritance. The controls below allow you to set up an environment for some computerized agents. Each of these agents produces a series of letters determined by its genome, which in this case is just a series of numbers corresponding to letters. The sets the criterion for determining which agents are successful (Use the classic target string example or enter your own). Agents that produce a series of letters that are closer to this target string have greater fitness, which increases their likelihood of reproducing—much like finding food or a mate would in real organisms. The more matching letters, the more likely it is that an agent will create offspring.
You can also specify the size of the population of agents by adjusting how many there are in each generation (). The exercise starts with this number of agents, which each produce a random string of letters. Agents are then graded on how close they were to the target string, and the best performing (or luckiest) agents are used to generate a new group of agents. The new generation also experiences random mutations from their parents; you can determine how common these mutations are using the . This process is repeated until either an agent mutates to match the target string or the maximum number of generations (you can specify this under ) is reached.
Feel free to play around with these factors and see what happens! Below, it will show you some example strings produced by agents in different generations. You can set which generation is output by changing the factor, which specifies how many generations will go by before showing the example strings.
We have included a second simulation here for comparison’s sake: computerized "monkeys" typing randomly. How does an evolutionary process stack up to a completely random process? (The infinite monkey theorem states that randomness will produce a solution... it will probably just take a really, really, really long time.)