The weasel program, Dawkins' weasel, or the Dawkins weasel is a thought experiment and a variety of computer simulations illustrating it. Their aim is to demonstrate that the process that drives evolutionary systems — random variation combined with non-random cumulative selection — is different from pure chance.
The thought experiment was formulated by Richard Dawkins, and the first simulation written by him; various other implementations of the program have been written by others.
I don't know who it was first pointed out that, given enough time, a monkey bashing away at random on a typewriter could produce all the works of Shakespeare. The operative phrase is, of course, given enough time. Let us limit the task facing our monkey somewhat. Suppose that he has to produce, not the complete works of Shakespeare but just the short sentence 'Methinks it is like a weasel', and we shall make it relatively easy by giving him a typewriter with a restricted keyboard, one with just the 26 (capital) letters, and a space bar. How long will he take to write this one little sentence?
The scenario is staged to produce a string of gibberish letters, assuming that the selection of each letter in a sequence of 28 characters will be random. The number of possible combinations in this random sequence is 2728, or about 1040, so the probability that the monkey will produce a given sequence is extremely low. Any particular sequence of 28 characters could be selected as a "target" phrase, all equally as improbable as Dawkins's chosen target, "METHINKS IT IS LIKE A WEASEL".
A computer program could be written to carry out the actions of Dawkins's hypothetical monkey, continuously generating combinations of 26 letters and spaces at high speed. Even at the rate of millions of combinations per second, it is unlikely, even given the entire lifetime of the universe to run, that the program would ever produce the phrase "METHINKS IT IS LIKE A WEASEL".
Dawkins intends this example to illustrate a common misunderstanding of evolutionary change, i.e. that DNA sequences or organic compounds such as proteins are the result of atoms randomly combining to form more complex structures. In these types of computations, any sequence of amino acids in a protein will be extraordinarily improbable (this is known as Hoyle's fallacy). Rather, evolution proceeds by hill climbing, as in adaptive landscapes.
Dawkins then goes on to show that a process of cumulative selection can take far fewer steps to reach any given target. In Dawkins's words:
We again use our computer monkey, but with a crucial difference in its program. It again begins by choosing a random sequence of 28 letters, just as before ... it duplicates it repeatedly, but with a certain chance of random error – 'mutation' – in the copying. The computer examines the mutant nonsense phrases, the 'progeny' of the original phrase, and chooses the one which, however slightly, most resembles the target phrase, METHINKS IT IS LIKE A WEASEL.
By repeating the procedure, a randomly generated sequence of 28 letters and spaces will be gradually changed each generation. The sequences progress through each generation:
- Generation 01: WDLTMNLT DTJBKWIRZREZLMQCO P 
- Generation 02: WDLTMNLT DTJBSWIRZREZLMQCO P
- Generation 10: MDLDMNLS ITJISWHRZREZ MECS P
- Generation 20: MELDINLS IT ISWPRKE Z WECSEL
- Generation 30: METHINGS IT ISWLIKE B WECSEL
- Generation 40: METHINKS IT IS LIKE I WEASEL
- Generation 43: METHINKS IT IS LIKE A WEASEL
The exact time taken by the computer to reach the target doesn't matter. If you want to know, it completed the whole exercise for me, the first time, while I was out to lunch. It took about half an hour. (Computer enthusiasts may think this unduly slow. The reason is that the program was written in BASIC, a sort of computer baby-talk. When I rewrote it in Pascal, it took 11 seconds.) Computers are a bit faster at this kind of thing than monkeys, but the difference really isn't significant. What matters is the difference between the time taken by cumulative selection, and the time which the same computer, working flat out at the same rate, would take to reach the target phrase if it were forced to use the other procedure of single-step selection: about a million million million million million years. This is more than a million million million times as long as the universe has so far existed.
Implications for biology
The program aims to demonstrate that the preservation of small changes in an evolving string of characters (or genes) can produce meaningful combinations in a relatively short time as long as there is some mechanism to select cumulative changes, whether it is a person identifying which traits are desirable (in the case of artificial selection) or a criterion of survival ("fitness") imposed by the environment (in the case of natural selection). Reproducing systems tend to preserve traits across generations, because the offspring inherit a copy of the parent's traits. It is the differences between offspring, the variations in copying, which become the basis for selection, allowing phrases closer to the target to survive, and the remaining variants to "die."
Dawkins discusses the issue of the mechanism of selection with respect to his "biomorphs" program:
The human eye has an active role to play in the story. It is the selecting agent. It surveys the litter of progeny and chooses one for breeding. ...Our model, in other words, is strictly a model of artificial selection, not natural selection. The criterion for 'success' is not the direct criterion of survival, as it is in true natural selection. In true natural selection, if a body has what it takes to survive, its genes automatically survive because they are inside it. So the genes that survive tend to be, automatically, those genes that confer on bodies the qualities that assist them to survive.
Regarding the example's applicability to biological evolution, he is careful to point out that it has its limitations:
Although the monkey/Shakespeare model is useful for explaining the distinction between single-step selection and cumulative selection, it is misleading in important ways. One of these is that, in each generation of selective 'breeding', the mutant 'progeny' phrases were judged according to the criterion of resemblance to a distant ideal target, the phrase METHINKS IT IS LIKE A WEASEL. Life isn't like that. Evolution has no long-term goal. There is no long-distance target, no final perfection to serve as a criterion for selection, although human vanity cherishes the absurd notion that our species is the final goal of evolution. In real life, the criterion for selection is always short-term, either simple survival or, more generally, reproductive success.
||This article's Criticism or Controversy section may compromise the article's neutral point of view of the subject. (November 2010)|
Dawkins's "weasel program" has been the subject of much debate. Intelligent Design proponent William A. Dembski has criticized its assumption that the intermittent stages of such a progression will be selected by evolutionary principles, and asserts that many genes that are useful in tandem would not have arisen independently. It is often suggested that the program works by "locking" a correct letter when it is found. Robert C. Newman, for example, misunderstands the basic algorithm:
For Dawkins, once the computer gets a particular character right, it never allows mutation to work on that character again.
(Mere Creation, p 437)
This misunderstanding has been repeated in the creationist community. Creation Ministries claims that "Once a letter falls into place, Dawkin's program ensures it won't mutate away". While this is not strictly correct, as the 8th iteration of the sample run to the right shows, the conservation of overall similarity to a target of a kind that Dawkins himself acknowledges is foreign to the evolutionary process seems to be a valid caution against accepting the model as a proof, rather than an interesting demonstration of the way characters could be preserved from generation to generation given an appropriate selection mechanism.
Dawkins broached several of these issues himself in The Blind Watchmaker, and has also responded to these criticisms by pointing out that the program was never intended to model biological evolution accurately, and that he very specifically described it as an artificial selection process from the outset, as the citation above shows. It was only meant to demonstrate the power of cumulative selection as compared to random selection, and show the complete unrealism of the popular notion of natural selection as "monkeys pounding on typewriters". These cautions need to be borne in mind as a qualification of Dawkins' enthusiastic rhetorical use of the model in The Blind Watchmaker.
The answer to this criticism is that it is the environment and favorable conditions as well as the higher number of mating events compared to mutation events in a given period of time that "lock" traits of a given species into place. Once a species has evolved a core set of traits that optimize it for an environment, it is unlikely to drift much for millions of years unless there is a drastic change in environmental conditions that prevent the traits from being useful, and even random mutations will be over-ruled by the larger number of instances of mating (where mutated genes will be more likely set back to the status of fellow species without the mutated trait) than the number of mutations in a given period of time. Only large numbers of mutations or a drastically changed environment for a long enough period of time can over-rule the stability of a species gene pool that is always shuffled slightly back to its norm by breeding events. In the case of the weasel program, it is the readability of the evolved sentence and its recognition as a quote from Shakespeare by humans that simulate this process.
It should also be pointed out that evolution doesn't know what the "target" sequence is. So it could have no method of deciding which sequence is more like the "target" sequence.
More complex models
In The Blind Watchmaker, Dawkins goes on to provide a graphical model of gene selection involving entities he calls biomorphs. These are two-dimensional sets of line segments which bear relationships to each other, drawn under the control of "genes" that determine the appearance of the biomorph. By selecting entities from sequential generations of biomorphs, an experimenter can guide the evolution of the figures toward given shapes, such as "airplane" or "octopus" biomorphs.
As a simulation, the biomorphs are not much closer to the actual genetic behavior of biological organisms. Like the Weasel program, their development is shaped by an external factor, in this case the decisions of the experimenter who chooses which of many possible shapes will go forward into the following generation. They do however serve to illustrate the concept of "genetic space," where each possible gene is treated as a dimension, and the actual genomes of living organisms make up a tiny fraction of all possible gene combinations, most of which will not produce a viable organism. As Dawkins puts it, "however many ways there may be of being alive, it is certain that there are vastly more ways of being dead".
In Climbing Mount Improbable, Dawkins responded to the limitations of the Weasel program by describing programs, written by other parties, that modeled the evolution of the spider web. He suggested that these programs were more realistic models of the evolutionary process, since they had no predetermined goal other than coming up with a web that caught more flies through a "trial and error" process. Spiderwebs were seen as good topics for evolutionary modeling because they were simple examples of biosystems that were easily visualized; the modeling programs successfully generated a range of spider webs similar to those found in nature.
Although Dawkins did not provide the source code for his program, a "Weasel" style algorithm could run as follows.
- Start with a random string of 28 characters.
- Make 100 copies of the string (reproduce).
- For each character in each of the 100 copies, with a probability of 5%, replace (mutate) the character with a new random character.
- Compare each new string with the target string "METHINKS IT IS LIKE A WEASEL", and give each a score (the number of letters in the string that are correct and in the correct position).
- If any of the new strings has a perfect score (28), halt. Otherwise, take the highest scoring string, and go to step 2.
For these purposes, a "character" is any uppercase letter, or a space. The number of copies per generation, and the chance of mutation per letter are not specified in Dawkins's book; 100 copies and a 5% mutation rate are examples. Correct letters are not "locked". Each correct letter may become incorrect in subsequent generations. The terms of the program and the existence of the target phrase do however mean that such 'negative mutations' will quickly be 'corrected'.
- Genetic algorithm
- Hoyle's fallacy
- Infinite monkey theorem
- Objections to evolution
- Watchmaker analogy
- Dawkins, R. (1986) The Blind Watchmaker Oxford University Press.
- For a string of 28 characters, with 27 possible characters (A-Z plus space), any randomly generated string has the probability one in 27^28 of being correct; that is approximately one in 10^40. If a program generating 10 million strings per second had been running since the start of the universe (around 14 billion years, or 10^17 seconds), it would have only generated around 10^24 strings by now.
- Note: the 4th character of line 1 is missing in Dawkins' text; however line 2 suggests it was probably a T
- Many examples of Weasel programs in various computer languages
- The Weasel Applet (the "weasel program" written in Java)
- Dawkin's Weasel demo applet (in Monash University's Virtual Lab)
- Talk.origins claim CF011_1 Dawkins' WEASEL simulation
- An open sourced python script by Iddo Friedberg