Evolution essay This is an "active essay" demonstrating some ideas about evolution, originally expressed by Richard Dawkins in his book _The Blind Watchmaker_. Here we're going to recapitulate his argument but with the processes described set in motion on the computer, as can't be done on the printed page. (This was inspired by Ted Kaehler's active essay in Smalltalk on the same subject.) Many people feel that evolution by natural selection can't account for the exquisitely complicated life we see around us, because natural selection is powered by chance, while complicated life is too improbable to arise by chance. It's true that mere randomness cannot produce complexity, and we'll see that truth in the demo below; but natural selection isn't *just* chance. So let's try to generate a complex structure by random chance, then see what else is needed. Our target is a string of letters, and we'll consider it more `organized' or `complex' the closer it comes to "METHINKS IT IS LIKE A WEASEL". We'll name our `mere chance' process Drifter, and our later, better process Evolver. They both start out empty: def goal METHINKS IT IS LIKE A WEASEL def Drifter def Evolver We'll fill them with random picks from 'alphabet': def alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ (There's an extra space before the "ABC..." because the goal contains spaces as well as letters.) Here's how Drifter works: we pick a random position within Drifter: let i random-index Drifter #11 then a random element of the alphabet: let r random-element alphabet #D and then set the character at the position to the selected element: do text-set Drifter i r Hit Alt-O to see it working -- the "def Drifter ..." line above should pick up a letter. (It might just replace a space with the same space, since that is a possible, though unlikely, `mutation'. If you keep hitting Alt-O it should change, though.) The Evolver will also update, but the machinery behind that appears below. Now for a display of the fitness of our two organisms, defined as the count of genes correct (i.e. positions that match the goal): let comparison compare goal Drifter #>>>>>>>>=>><>>=>>>>=>=>>>>>> let Drifter-fitness count "=" comparison #4 let comparison compare goal Evolver #>>>>>>>>=>>=>>=>>>>=>=>>>>>> let evolver-fitness count "=" comparison #5 So, watching this, we can see that Drifter's fitness drifts around 1/27 of the maximum fitness, and is horribly unlikely to get close to the maximum -- getting the maximum would be like rolling a die 28 times in a row and calling each result in advance. (Only worse, since a die only has 6 sides, compared to 27 `sides' here -- 26 letters plus the space.) Even a nation of gamblers couldn't expect that much luck in the lifetime of the universe. So let's try to make something better with the Evolver. This version will only pass mutations that don't lower the fitness. First we create a child as a copy of Evolver with one letter changed at random: let child copy Evolver # J let i random-index child #18 let r random-element alphabet #J do text-set child i r And we compute the child's fitness: let comparison compare goal child #>>>>>>>>=>>=>>=>>><=>=>>>>>> let child-fitness count "=" comparison #5 Finally, we replace the Evolver with its child unless the child's fitness is lower than its parent's: let selected notless child-fitness evolver-fitness #true when selected do replace Evolver child Evolver's fitness now tends to maximum within around a thousand steps. This shows that a process with random mutations can produce extraordinarily improbable complex results if improvements are *cumulative*. The problem with Drifter is that any improvements in one generation are forgotten in the next. This can't be considered a realistic model of evolution; most obviously, it has one particular goal wired in from the start, where life has no goal. All we've done here is refute the creationists' claim that random mutations can't produce improbable results in a reasonable time; they can, if the changes can accumulate. This creationist argument would make sense if biologists were saying that, for example, one day an ape gave birth to a human, fully formed. But nobody says that; we must have had a long lineage shading imperceptibly from near-apes to near-humans, with each change along the way being reasonably likely on its own. Some things to try: bear n offspring, selecting just one per generation, with fitness-proportional selection. Vary the mutation rate. Look for the error catastrophe.