Hamlet: Do you see yonder cloud that’s almost in shape of a camel?
Polonius: By the mass, and ’tis like a camel, indeed.
Hamlet: Methinks it is like a weasel.
In attempting to discredit evolution by natural selection, creationists have often described the impossibility of random mutations in DNA being capable of anything beneficial as the equivalent of a tornado in a junkyard accidentally building a 747 or a group of monkeys bashing the keys of a typewriter to successfully write the works of Shakespeare.
And they’re right. If evolution was merely random mutations then it would be unfathomably impossible for life to evolve as it does. But here’s the rub: no evolutionary biologists claim that random mutations alone cause the diversity of life we observe. This is where the crucial natural selection part comes in. Evolution occurs by random mutations, most of them neutral, where any beneficial mutations are selected for by the environment and those successful mutations go on to have more children who will likely inherit those beneficial mutations. And so on and so on.
To illustrate the point, back in 1986 Richard Dawkins in his book, The Blind Watchmaker demonstrated a simple program which he named ‘Weasel‘ as a reference to the concept of monkeys and typewriters and the above quote from Shakespeare. ‘Weasel’ starts with a jumble of letters, spawns ‘children’ from them (i.e. multiple copies), each with slight mutations and selects whichever ‘child’ is the most similar to a target phrase to spawn a new generation of children.
The point of the program was not to demonstrate every aspect of evolution by natural selection (that’s rather too much to ask of a small page of code), just the power of mutation when combined with a selection process as opposed to brute-force random chance.
Below I’ve created a simple version of Dawkins’ program that is limited to a single word and which will, due to the limitations of Javascript and browsers, only attempt a maximum of 500 generations. Have a play around to get a feel for how random mutations can result in very non-random outcomes when there is a selection criteria combined with heritability.
(Note: an updated version is available in a new post, Methinks it is [still] like a weasel)
Full screen version
If you know how to run Python and want to check out a version closer to that of the original ‘Weasel’, take a look at the one created by fellow blogger and PhD student in evolutionary genetics, David, over at The Ativism. His is not limited to 500 generations like mine and he includes the newer concept of the option of ‘locking’ successful mutations.