2 The Blind Watchmaker

2.1 Background

If a pocket watch is found on a heath, it is most reasonable to assume that someone dropped it and that it was made by at least one watchmaker, not by natural forces.

This is the “watchmaker analogy”, made famous by the theologian William Paley in his book Natural Theology (1802), more than 50 years before Darwin published On the Origin of Species. Paley argued that, just as finding a pocket watch would naturally lead one to infer a skilled watchmaker, the intricate structures and adaptations of living organisms (such as the eye) must also imply the existence of an intelligent designer. Darwin read Paley as a student at Cambridge and admired the argument; his theory of natural selection was, in part, an answer to it.

More than a century later, the evolutionary biologist Richard Dawkins took up the same image in his 1986 book The Blind Watchmaker. Dawkins argued that the complexity and diversity of life can arise through a “blind” process, natural selection, which is unguided and has no foresight. Evolution, like a blind watchmaker, can achieve impressive complexity through small, incremental changes selected over long periods of time.

2.1.1 Randomness and Selection

In this exercise, we will explore how random variation, when paired with selection, can lead to outcomes that would otherwise seem impossible. We will use an R program to simulate the typing of a target sentence through random letter generation. This is a simplified version of a famous computer program described by Dawkins, who used the target phrase “METHINKS IT IS LIKE A WEASEL” (a line from Shakespeare’s Hamlet).

The key idea is the difference between two kinds of selection that Dawkins described:

  • Single-step selection: the whole phrase is produced at random in one go, and kept only if it is completely right. Every attempt starts again from scratch.
  • Cumulative selection: each generation starts from the previous one, and improvements are kept and built on.

By simulating this process, you will discover how random changes alone produce nonsense, but random changes combined with cumulative selection quickly reach the target.

2.2 Learning outcomes

Learning outcomes:

  • Gain a deeper understanding of adaptive evolution via natural selection.
  • Explain the difference between single-step and cumulative selection.
  • Recognise how random change can lead to order if paired with selection.
  • Run and modify a simple R simulation to explore a biological idea.

2.3 Worked example

2.3.1 Inputs

Imagine you are typing random letters on a typewriter. How long would it take to type a sensible sentence by pure chance? Take Dawkins’ phrase “METHINKS IT IS LIKE A WEASEL” (28 characters, including spaces).

2.3.2 Steps

The R code below picks each character at random from the 26 letters of the alphabet plus a space, giving a pool of 27 possible characters at each position. The chance of randomly typing the first letter correctly is 1 in 27. The probability of getting the first two letters right is \((1/27)^2\), and the chance of typing the entire 28-character phrase correctly in one attempt is \((1/27)^{28} \approx 8 \times 10^{-41}\). On average you would need about \(27^{28} \approx 1.2 \times 10^{40}\) attempts. This is single-step selection, and it would never work in practice.

2.3.3 Output and interpretation

But what if every correct letter was kept, and only the wrong ones were typed again in the next generation? That is cumulative selection. Let’s find out how much difference it makes.

2.4 Your task

  1. Make sure you have both R and RStudio installed.
  2. Open RStudio.
  3. Open a new script (File > New File > New Script)
  4. Copy and paste the R code (below) into your script.
  5. Save your script with a memorable file name.

Note: only edit the top part of the code (above the line of # symbols). The phrase can only contain letters and spaces.

Predict first

Before you run the code, write down your predictions:

  • With selection turned on, roughly how many generations will it take to reach the target phrase? 10? 100? 10,000?
  • With selection turned off, will it ever get there?

2.4.1 The code

phrase <- "Methinks it is like a weasel"
nGenerations <- 200
selection <- TRUE

###################################################
# Do not edit below this line
pool <- c(LETTERS, " ")
phraseSplit <- unlist(strsplit(toupper(phrase), ""))
if (!all(phraseSplit %in% pool)) stop("Use only letters and spaces in the phrase")
output <- data.frame(generation = 1:nGenerations, 
                     phrase = rep(NA, nGenerations))
fixed <- NULL
for (i in 1:nGenerations){
  randomPhrase <- sample(pool, length(phraseSplit), replace = TRUE)
  if(selection == TRUE) {
    randomPhrase[fixed] <- phraseSplit[fixed]
    fixed <- append(fixed, which(randomPhrase == phraseSplit))
    fixed <- sort(unique(fixed))
  }
  output$phrase[i] <- paste(randomPhrase, collapse = "")
}
###################################################

output

# First generation that matches the target (NA if it was never reached)
which(output$phrase == paste(phraseSplit, collapse = ""))[1]

2.5 How the simulation works

An instructor will explain the code and demonstrate its use.

The program generates a random sequence of characters of the same length as the target phrase (stored in phrase). If selection is turned on (selection <- TRUE), correct letters are “fixed” in place and kept in every following generation, while incorrect letters continue to be replaced at random. This is cumulative selection: each generation builds on the one before.

Over the generations, the number of correct letters builds up until the sequence matches the target phrase. The last line of the code tells you the generation at which this happened. With selection turned off, each generation is a fresh random guess (single-step selection), and no meaningful sentence appears.

Note that this program is a simplified version of Dawkins’ original. Here, each correct letter is locked in place and can never change again. Dawkins’ program instead made a population of copies of the current phrase, each with a few random copying errors (mutations), and kept the copy closest to the target. In that version a correct letter can, in principle, be lost again, as in real populations. Both versions show the same thing: cumulative selection is enormously faster than chance alone.

Try it yourself

  1. Change the phrase: make it shorter or longer (letters and spaces only). How does this change the number of generations needed?
  2. Change the number of generations: experiment with different values for nGenerations. With 100 generations, is the target always reached?
  3. Repeat the simulation: run the code again with the same settings. Does it always take the same number of generations?
  4. Turn selection off: set selection <- FALSE. What happens?

2.6 Questions

  • What happens if selection is turned OFF?
  • Does the number of generations affect whether the target phrase is reached?
  • Does the speed of reaching the target phrase depend on the length of the phrase?
  • How does this simulation differ from real natural selection?

2.7 Takeaways

  • Cumulative selection, which keeps and builds on small random improvements, is enormously faster than single-step selection (pure chance).
  • Random variation alone is extremely unlikely to generate complex outcomes, but selection changes the odds.
  • Real natural selection has no target; it favours traits that improve fitness in the current environment.