Kick back and get started at your own pace.

## Dawkins Weasel Simulation

Methinks it is like a weasel
— Hamlet, 3.2.379

In The Blind Watchmaker, Richard Dawkins wrote of a thought experiment that was based on the infinite monkey theorem, which states that a monkey hitting random keys on a keyboard, given infinite time, will almost surely type a given text. Usually, the complete works of Shakespeare are alluded to. The term almost surely is referenced in the way it is used in probability theory.

Dawkins referenced the theorem in response to the misconception that natural selection, the driving force behind adaptation, is driven by purely random chance. The key factor that shapes how a population adapts is that the traits most likely to be passed on are those which are best suited for the environment in which a population finds itself. To illulstrate the key roll the environment plays in natural selection, Dawkins limits the the infinite monkey theorem such that the monkey must only produce a small passage of dialogue from Hamlet, and the keyboard layout is limited to only capital letters and a space bar.

Now, we need to simulate adaptation. As an analogue to the environment, a target phrase is selected, such as METHINKS IT IS LIKE A WEASEL. We start with a randomly generated string as the parent generation. Each generation is composed of two hundred offspring, using the parent as a basis. Each offspring produced has a five percent chance to produce a mutated letter, per letter slot. After two hundred offspring are produced, the best is chosen to carry on the next generation.

Although the model is somewhat simplistic, it should be noted that offspring have the chance to produce wrong letters, even where the parent string has correct letters. Dawkins received criticism for keeping correct letters fixed, though it wasn't the case for his original program either. The goal is to demonstrate that the process of cumulative selection is vastly different from purely random, single selection.

Given a 27-character alphabet and that the phrase to produce is 28 characters, simple combinatorics shows the possible combinations totals to $28^{27}$, or about $1.2\times10^{39}$. When factoring in the effect that the environment has in shaping the evolution of a species, the outcome is not based purely on chance. Life is plastic to its environment. A simulation of the Dawkins Weasel program is below.

Birthing...