Dawkins weasel

In his 1986 book The Blind Watchmaker, Richard Dawkins presents an algorithm which became known as the Dawkins Weasel.

In action
Thanks to the marvels of the modern Internet, you can see the weasel for yourself. Click the start button to see the phrase "evolve" before your very eyes!

METHINKS IT IS LIKE A WEASEL

By repeating the process you can begin to get a picture of how evolution can work. Sometimes it happens fast, sometimes slowly. Sometimes it gets word pretty quick while the rest of the phrase lingers around looking like gibberish. Other times it gets stuck in gibberish land until one tiny kick lets it evolve quickly. Of course, evolution isn't always directional like this, the Weasel program certainly has an aim; to reproduce the exact phrase put into it from randomness and variation. However, natural selection does favour certain aspects or abilities or traits over others and the Weasel program certainly does simulate this. In the case of the algorithm, it generates an "environment" that favours strings of words that look like ME THINKS IT IS LIKE A WEASEL, just like a green environment would favour green insects as they would camouflage themselves against predators. Thus, when the algorithm runs, it uses random mutation, followed by natural selection, to derive something that is optimal for the environment it's in.

Implementation
The algorithm has been implemented in various programming languages by numerous programmers. Most implementations are quite similar, along the following lines:


 * 1) choose random string
 * 2) copy string n times with mutation
 * 3) take best fitting string
 * 4) Stop, if the number of correct letters is 28, otherwise
 * 5) goto 2

Step 3 includes the evaluation of a fitness function. Virtually all implementations define the best fitting string as the one with the most correct letters - a number between 0 and 28.

William Dembski, being a noted intelligent design advocate, chooses another way:


 * 1) choose random string
 * 2) if all letters are in place: STOP Otherwise:
 * 3) mutate letters which are not in place
 * 4) goto 2

Surprisingly, Dembski insists that this is the implementation Richard Dawkins used in his book - though Dawkins himself says otherwise. Answers in Genesis makes the same claim. The intellectual dishonesty in both cases is obvious as there exist examples of freely available scripts implementing the algorithm which clearly do allow for the mutation of in-place characters.

This confusion is doubtless because the fitness function used combined with a small percentage chance of mutations does not encourage regressions in small strings. Using a longer sentence and increasing the mutation chance as high as 10% tends to give regressions in many generations, even to the point where the fittest in the generation is not as fit as its progenitor. High mutation rates take longer to converge on the wanted solution, which may seem at first somewhat counter intuitive.