Virtual monkeys recreate Shakespeare? Methinks not

Tackling the infinite monkey theorum, a programmer says he's recreated Shakespeare through random typing. It's a great idea, but the claim is too grand.

Jesse Anderson announced his random-typing-monkey program's literary accomplishments Friday.
Jesse Anderson announced his random-typing-monkey program's literary accomplishments Friday. screenshot by Stephen Shankland/CNET

I was pleasantly surprised today to hear of Jesse Anderson's success in getting randomly typing virtual monkeys to recreate a Shakespeare poem.

Alas and alack, though, I found this tale of computational prowess conquering statistical improbability too good to be true.

Anderson said his virtual monkeys successfully recreated A Lover's Complaint, an astounding accomplishment given that it has, by my count, 13,940 characters in 2,587 words. Anderson, a programmer in Reno, Nev., said on Friday:

Today (2011-09-23) at 2:30 PST the monkeys successfully randomly recreated "A Lover's Complaint." This is the first time a work of Shakespeare has actually been randomly reproduced. Furthermore, this is the largest work ever randomly reproduced. It is one small step for a monkey, one giant leap for virtual primates everywhere.

For those of you baffled by this exercise, here's the background: the infinite monkey theorum states that given an infinite amount of time, a monkey randomly banging on a typewriter will eventually produce Shakespeare's plays. It's an idea whose amusing imagery lends itself well to fanciful imaginings. My favorite referencer is in Douglas Adams' humor sci-fi book, "The Hitchhiker's Guide to the Galaxy," in which, as a byproduct of a spaceship's "infinite improbability drive," an infinite number of monkeys write Hamlet.

Unfortunately, I can celebrate Anderson's initiative, but not really his actual achievement.

That's because his virtual monkeys--really just programs randomly generating typed characters--didn't actually recreate the poem. They just recreated all the nine-character blocks of text used in the poem, according to Anderson's YouTube explanation.

"There are 5.5 trillion different permutations of nine characters," Anderson said. "We're creating nine-character sets and seeing if part of that matches Shakespeare." Once a particular nine-character string is found to match Shakespeare's text--"conceited," to pick a recognizable example, or "le and pi" for some characters spanning three words in the poem--it's marked off as "discovered" by the monkeys. Once all the text is thus marked, the poem is considered recreated.

The real trick, though, would be recreating the entire poem, of course, something that is vastly less probable than finding all the sets of nine characters used in a poem. In other words, for "A Lover's Complaint," that would mean a monkey typed the single correct 13,940-character set.

Even with a limited alphabet using no spaces, capital letters, or punctuation, this is an enormously unlikely event. For example, look at this boiled-down Shakespeare snippet--"whatsinanamethatwhichwecallarosebyanyothernamewouldsmellassweet"--that's 63 characters long.

The chances of picking that particular tidbit out of 63 randomly generated characters is 1 in 26 to the power of 63. Wolfram Alpha informs me that 2663 is more than 139 octovigintillion (139 with 87 zeros after it), and 1.4 billion times the number of atoms in the visible universe. Give or take.

Using Anderson's method of nine-character sets makes the task manageable without having to wait forever, so to speak. But as long as you're making things more convenient, why not pick one-character sets? I don't think it would take an actual monkey too long to type all 26 letters in the alphabet by randomly bashing a keyboard.

So I applaud Anderson for jumping into an entertaining area of computing. But please accept my apologies for being a buzzkill, because I don't think a Shakespeare poem has actually been "randomly reproduced."

I probably should take Anderson's own advice, though, to keep calm and carry on. Or at least to lighten up.

"I understand the definition of infinite and infinite monkey theorem, and I realize that this project does not have infinite resources," Anderson said. "This project is my attempt to find a creative way to attain an answer without infinite resources. It is a fun side project."



Conversation powered by Livefyre

Don't Miss
Hot Products
Trending on CNET

Hot on CNET

The Next Big Thing

Consoles go wide and far beyond gaming with power and realism.