Forgot password
Enter the email address you used when you joined and we'll send you instructions to reset your password.
If you used Apple or Google to create your account, this process will create a password for your existing account.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Reset password instructions sent. If you have an account with us, you will receive an email within a few minutes.
Something went wrong. Try again or contact support if the problem persists.
Escapist logo header image

Virtual Typewriter Monkeys Pen Complete Works of Shakespeare (Almost)

This article is over 13 years old and may contain outdated information
image

Fake monkeys aim to prove Shakespeare “just got lucky.”

Back in 2003, the UK’s Paignton Zoo decided to perform a small experiment with a group of six crested macaques and a keyboard. Its intention was to physically test the idea that given enough typewriters and time, one can expect a group of monkeys to eventually happen upon and produce Shakespeare’s Hamlet. The zoo’s trial run went exactly as you may expect: After a month of access to the keyboard, the monkeys had produced five pages of the letter “S” and expertly covered the test equipment in urine and feces. Now, about eight years later, US programmer Jesse Anderson has taken these unfocused monkeys (and their feces) out of the equation for good. By creating a virtual menagerie of millions of virtual monkeys, Anderson is close to proving correct this long-pondered question of probability. So far, his crack squad of pretend primates has finished 99.99 % of not just Hamlet, but the entire catalog of Shakespeare’s work.

The system was built on Amazon’s EC2, a scalable cloud computing system that allows web designers and programmers to perform high-level computations from consumer-grade home computers. Each “monkey” is represented by a small program that lives on the server, randomly producing nine-character-long sequences that are subsequently checked by a database of The Bard’s collective musings. If the character string matches, it’s kept and stored. If even one character is off, it’s flung like monkey dung to the recycle bin. At first glance, it may seem like producing a correct sequence of nine characters would be easy for millions of programs designed to do nothing else, but to put that in perspective, there are approximately 5.5 trillion possible nine-character combinations in the English language from which to randomly choose.

Still, you may notice that this “evolutionary” method isn’t a perfect recreation of the original thought experiment. If these monkeys were real, each attempt would be independent of a nine-character veracity check, and thereby decrease the probability of success exponentially. According to Dr. Ian Stewart, emeritus professor of mathematics at the University of Warwick, achieving Anderson’s results within the parameters of the original puzzler would take “far longer than the age of the Universe,” which in case you were wondering, is about 13.7 billion years. “Along the way there would be untold numbers of attempts with one character wrong; even more with two wrong, and so on,” Stewart explains. “Almost all other books, being shorter, would appear [countless times] before Shakespeare did.”

Still, Anderson’s attempt remains impressive, and at the very least, just plain fun. With the complete works of Shakespeare totaling some 3,695,990 characters or so, and Anderson’s code-monkey sweatshop at 99.99%, we can extrapolate that he is missing only 369 words from completing the library. I can only imagine, however, that the last bit will take the longest, as the number of correct sequences available has, at this point, diminished severely. Anderson reached his 99.99% within only six weeks, and since I’m too lazy to the math that would determine just how quickly his results have decelerated over time, let’s just say his monkeys will be done soon. Probably.

Source: BBC

Recommended Videos

The Escapist is supported by our audience. When you purchase through links on our site, we may earn a small affiliate commission.Ā Learn more about our Affiliate Policy