Monday, December 13, 2010

Understanding uncertainty: Infinite monkey business

The idea that an infinite number of monkeys typing at random on an infinite number of typewriters will eventually produce the complete works of Shakespeare apparently dates from 1913, and has appeared repeatedly in popular culture ever since. When the BBC Horizon team decided to make a programme about infinity. We said we needed a program to churn out random letters and match them to Shakespeare, and so they commissioned a Monkey Simulator program from Aaron Russell, which is available from this website.
The Monkey Simulator program generates random symbols from a list of 31 options: 26 lower-case letters, a space, a comma, a full stop, a semicolon and a hyphen. After a sequence of four symbols has been generated, the program searches for a match in a stored plain-text version of the Complete Works of Shakespeare, ignoring whether a letter is capital or lower-case. If the procedure finds one or more matches, it generates a further character and again checks if there is a match for five symbols, and so on, until no matches are found. Then it starts again with a new sequence of four characters. Characters are generated at a rate of 50 per second. (We note that this procedure cannot match sequences that stretch over the 36,357 line returns in the text file, and also cannot match all the other punctuation in the text, such as the 10,475 question marks and 8,827 exclamation marks.)

No comments:

Post a Comment