Slashdot Mirror


A Few Million Virtual Monkeys Randomly Recreate Shakespeare

First time accepted submitter eljefe6a writes "On September 23 at 2:30 PST the A Million Amazonian Monkeys project successfully recreated A Lover's Complaint. This is the first time a work of Shakespeare has actually been randomly reproduced. It is one small step for a monkey, one giant leap for virtual primates everywhere. From the article: 'For this project, I used Hadoop, Amazon EC2, and Ubuntu Linux. Since I don’t have real monkeys, I have to create fake Amazonian Map Monkeys. The Map Monkeys create random data in ASCII between a and z. It uses Sean Luke’s Mersenne Twister to make sure I have fast, random, well behaved monkeys. Once the monkey’s output is mapped, it is passed to the reducer which runs the characters through a Bloom Field membership test. If the monkey output passes the membership test, the Shakespearean works are checked using a string comparison. If that passes, a genius monkey has written 9 characters of Shakespeare. The source material is all of Shakespeare’s works as taken from Project Gutenberg.'"

33 of 312 comments (clear)

  1. Re:Frankly, that's cool by syousef · · Score: 2

    I wish I'd thought of it - and what a neat way to go about it.

    So is it safe to say you're virtually impressed with the whole affair?

    --
    These posts express my own personal views, not those of my employer
  2. Sequential wording by drmitch · · Score: 2

    I always thought the idea was that the characters would be produced sequentially throughout the entire play, not just every word produced independently. Much less credit.

  3. HRmm...... by malakai · · Score: 5, Insightful

    If i'm understanding this, this isn't as cool as it seems. It seems like his 'monkeys' are just randomly creating words, and he matches those words against any word used in Shakespeare. If he gets a match, he marks that one as done. So, as some point one monkey made the word "be" and all of a sudden green lights all over the place.

    I think the original saying was how random and unique it would be for a solid set of strings to randomly create a whole piece of work _in one go_ . Not a word here, a word there, OMG 100% of Shakespeare words have been randomly created.

    1. Re:HRmm...... by Dan+East · · Score: 5, Insightful

      Exactly. So if it's going to be done in this way, then why not break it down into INDIVIDUAL characters. Have a monkey generate a single letter, and see if that happens to match something one of Shakespeare's works. I bet that algorithm would be even faster.

      --
      Better known as 318230.
    2. Re:HRmm...... by Anubis+IV · · Score: 2

      You nailed it. The problem becomes more difficult as the number of characters and words increases, for the simple reason that you have to go further without a mistake having been made. If something like a Bogosort takes O(n*n!), I shudder to think how long recreating the works of Shakespeare would take, but that's the very point of the expression: to express the unlikelihood of a random set of occurrences leading to an outcome.

    3. Re:HRmm...... by FrootLoops · · Score: 2

      Trillions of years is generous. A million monkeys each making a unique 100 bit binary string every second would still take around 40 quadrillion years. This *vastly* underestimates the time of an actual paragraph, let alone multiple paragraphs, and it's still 40,000 times larger than the trillion years estimate.

    4. Re:HRmm...... by cgenman · · Score: 4, Insightful

      It's not that a million monkeys could randomly create the works of Shakespeare. It is that an infinite number of monkeys could recreate all of the work in the known world, including Shakespeare. The thing about infinity, is that it is really, really big. If the amount of resources thrown at a problem is truly infinite, all possible results just happen, no matter how improbable.

      The point of the saying is how mind-meldingly large infinite is, and how bad our minds are at comprehending the ramifications. This is one.

    5. Re:HRmm...... by bws111 · · Score: 2

      Yep. This whole 'experiment' reminds me of the Monty Python Great Actor skit:

      Sir Edwin: Ah, well, I don't want you to get the impression it's just a question of the number of words... um... I mean, getting them in the right order is just as important. Old Peter Hall used to say to me, 'They're all there Eddie, now we've got to get them in the right order.'

  4. Oblig. Simpsons by Brett+Buck · · Score: 4, Funny

    "It was the best of times, it was the BLURST of times! Stupid monkeys!" {strikes them with script...}

  5. Does anyone else think this is supid? by nzac · · Score: 5, Insightful

    and that he missed the point of the expression?

    Of course it will work the Mersenne twister will eventually cover the entire 9 letter space and then he can search though for the parts that match (yes he is doing it concurrently but that’s just an inefficient way of doing it). If he had the RAM and time he could eventually recreate every book possible.

    The Wikipedia page explains it better that infinite random sting is bound to contain something that is perceived as useful. Of course the literal take on on the expression is the most funny.

    1. Re:Does anyone else think this is supid? by dudpixel · · Score: 2

      Surely this is obvious.

      1 million monkeys on typewriters coming up with 9 CHARACTERS of shakespeare each is just a tad more likely than any monkey (from a team of 1 million) coming up with the ENTIRE WORK of shakespeare.

      I'm not really sure what this guy set out to prove.

      --
      This seemed like a reasonable sig at the time.
    2. Re:Does anyone else think this is supid? by v(*_*)vvvv · · Score: 2

      Ya, and they certainly got a lot of help to recreate Shakespeare... like human help.

      These monkeys were no ordinary monkeys either. First and foremost, they BEHAVE.

      It's like he didn't even understand the expression as GP said, yet went out to demonstrate his misunderstanding literally. ... and that is what makes this story interesting :)

  6. It is in fact virtually impossible by martin-boundary · · Score: 5, Insightful
    This experiment, while fun, isn't exactly the infinite monkey experiment.

    What's happening here (if I understand the writeup) is that the monkeys are typing random letter combinations, until they hit a small phrase that happens to be in shakespeare. Then that phrase is marked as done.

    Let n be the size in characters of the target phrase. If n=1, then the complete works of shakespeare are obtained as soon as each of the letters of the alphabet have been typed at least once. You could do this in a few seconds on your computer keyboard. If n=2, then the complete works are obtained as soon as all the possible pairs of letters have been typed. The experiment in TFA has n=9 I think.

    As n grows larger, the time until completion grows exponentially. Once his expeiment is done, the case n=10 should take roughly 26 times as long (ignoring punctuation capitals and diacritical marks). Alternatively, it would require a cloud roughly 26 times bigger to do it in the same amount of time.

  7. I did think of it. by Chibi+Merrow · · Score: 4, Insightful

    I did think of it. I even registered a domain (see my URL and e-mail address). Planned on making a screensaver that would randomly generate stuff, and convince people to run it, ala SETI@Home. Then college happened, then graduate school happened, then marriage happened, then baby happened... And then (once again), I read on SlashDot that someone else has done one of my ideas again and made the front page.

    But then again, literally as I'm reading this, my daughter is singing the Blue's Clues theme song next to me while my wife and I get ready to queue up for our nightly game of League of Legends... Sitting in the downstairs den/office that's full of years of gamer stuff that all represents the happy memories of those several years of college. That guy can have my monkeys. Good for him. I found something better. :)

    --
    Maxim: People cannot follow directions.
    Increases in truth directly with the length of time spent explaining them
    1. Re:I did think of it. by eljefe6a · · Score: 2

      I am the submitter, the editor got my username wrong. Anyway I have a wife and family. My daughter was buzzing around me as I wrote the program. I would say we both found something better except for the gaming. I game, but I realize it is mostly a waste of time that can prevent you from doing the cool stuff you want to do.

    2. Re:I did think of it. by bill_mcgonigle · · Score: 4, Insightful

      One thing the Internet has taught me is that (nearly) all my ideas are non-unique. It's the execution that counts.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    3. Re:I did think of it. by tunapez · · Score: 4, Funny

      I almost meant to say that exact same thing!

      --
      Imagination drew in bold strokes, instantly serving hopes and fears, while knowledge advanced by slow increments...
    4. Re:I did think of it. by Chibi+Merrow · · Score: 2

      No! I'm saving them for that sour wine I'll never make!

      --
      Maxim: People cannot follow directions.
      Increases in truth directly with the length of time spent explaining them
    5. Re:I did think of it. by Fluffeh · · Score: 2

      I was meaning to say that exact same thing - almost.

      --
      Moved to http://soylentnews.org/. You are invited to join us too!
    6. Re:I did think of it. by TheRaven64 · · Score: 2

      Yup. Execution seems like a good solution there too...

      --
      I am TheRaven on Soylent News
  8. Re:Real monkeys by ozmanjusri · · Score: 2

    all real monkeys have progressed to randomly downloading things from bit-torrent.

    Sadly, in my experience you're more likely to find them here:
    http://www.microsoft.com/learning/en/us/certification/mcse.aspx

    --
    "I've got more toys than Teruhisa Kitahara."
  9. Re:Huh? by Sarten-X · · Score: 4, Insightful

    As a programmer of several "stupid computer tricks" myself (like a filesystem driver for mounting IRC!), I am very appreciative for the fast computers that let us simulate very complex systems very quickly. I understand that it is my responsibility, as a software engineer, to use that speed and memory efficiently to optimize the results of the simulation.

    This project has generated better illustrative proof than ever before that randomness will eventually produce everything. This is often a difficult concept for non-mathematical people to accept, so a nice example is always welcome among those who seek to educate. It is also worth noting that this project is running on Hadoop, which is not yet considered stable. While monkeys type Shakespeare, they also find bugs, stress-test releases, and educate at least one programmer. After such a test, Hadoop is much more favorable as a platform for more "real computing work" projects, like processing medical records looking for previously-unknown medication side effects.

    While on the subject of "real computing work", please note that all nontrivial computation is done by software, and that all software can run on a Turing machine as designed in 1937. Those hardware engineers are doing real electrical engineering work, making circuits run with less power and smaller size. Those chemical engineers are doing real chemistry work, making semiconductors that can switch faster and at lower voltage. The software engineers are doing real computing work, finding fast algorithms and optimizing processes.

    --
    You do not have a moral or legal right to do absolutely anything you want.
  10. Re:Frankly, that's cool by hedwards · · Score: 2

    It would be a foregone conclusion if monkeys were indeed randomly typing on a keyboard. But in practice, they tend to like certain keys leading to at best a pseudo random distribution of keystrokes. On top of that, many of the characters needed to produce the works require not just one keystroke, but a shift and a keystroke to work.

    Consequently, simulating this with virtual monkeys is almost sure to come up with a result that differs substantively from using actual monkeys to do the project.

  11. Re:Huh? by lokedhs · · Score: 3, Funny

    I also doesn't reproduce Shakespeare in its original Klingon...

  12. Re:Huh? by Jeremi · · Score: 2

    This project has generated better illustrative proof than ever before that randomness will eventually produce everything. This is often a difficult concept for non-mathematical people to accept, so a nice example is always welcome among those who seek to educate.

    Here's a simpler example:

    while(1)
    {
          int x = rand() % 10;
          if (x==666) printf("Yes, everything!\n");
    }

    --


    I don't care if it's 90,000 hectares. That lake was not my doing.
  13. Re:Amazonian President?? by Jeremi · · Score: 2

    Couldn't be worse at it than the last couple ;)

    Clearly you haven't been watching the Republican debates... ;^)

    --


    I don't care if it's 90,000 hectares. That lake was not my doing.
  14. Re:It is in fact virtually impossible by Anonymous Coward · · Score: 4, Insightful

    Exactly. Breaking down the problem of "randomly finding thousands of characters in the right order" to "randomly finding 9 characters in the right order" is bullshit, because this requires information about the order of all the 9-character-blobs you find.

    In other news: I compressed a Gigabyte down to 2 bits. You just have to know the order of the bits!

    Stupid article. Stupid submitter. Stupid waste of energy. That's the 21st century for you. Idiocracy at its best.

  15. Re:It is in fact virtually impossible by cgenman · · Score: 3, Insightful

    You could prove that for the length of a work of Shakespeare (N), the amount of "monkeys" required to solve the problem in the same amount of time is 26^(N-9). Or, as it relates to the proverb, the solution to the equation has the time required to create a work of Shakespeare as infinite and the number of monkeys required to solve it in that time as infinite.

    Of course, that solution didn't require programming the monkeys. But it is extrapolatable out to an entire work.

  16. Re:Frankly, that's cool by Oligonicella · · Score: 5, Informative

    Beyond that, it didn't even accomplish it's goal. The idea is not that a hundred or more monkeys can hammer out nine character chunks that could be assembled *by man* into the complete work, it is that a hundred monkeys could hammer at typewriters for some undetermined length of time and one of them would randomly produce the complete work *alone*.

    That didn't happen.

  17. Re:9 characters at a time?!?? by mwvdlee · · Score: 2

    My thoughts exactly.
    If he had the virtual monkeys type random sequences of 1 character each, he'd have found one of Shakespeare's much sooner.
    The typical interpretation would require a single monkey to have typed the entire document.
    Nice try, but no banana.

    --
    Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  18. Re:It is in fact virtually impossible by TheRaven64 · · Score: 2, Informative

    But that defeats the point. Why 9-character segments? Why not 1-character segments? Then, when each letter has been generated once by your random number generator, you say 'done' and move on. The point of the gedankenexperiment is to show that a true random number generator will eventually produce any sequence, irrespective of whether you ascribe some meaning to that phrase or not. For example, it is just as probable that a monkey would type 'the original submitter is an idiot who misses the point of probability' as it is that they would type 'mfdag gfnaif pwrg kflgsq hmthwrhdga adsfjn fadfm asdfned qemangasd asv'. They are both 70-character strings of lowercase ASCII characters and spaces, and if you have a random number generator set up to produce these with no bias towards letter frequencies then either combination is equally probable. This 'experiment' added an extra step of determinism, which means that it is not an unbiased random number generator, it's a very badly designed program for generating a Shakespeare play.

    --
    I am TheRaven on Soylent News
  19. Re:Frankly, that's cool by RobDude · · Score: 4, Insightful

    I don't even understand it.....

    He randomly generates 9 characters until he gets the 9 characters he wants. Then he repeats until he has the Shakespeare book he wanted? That's not how 'random' works. Why 9 characters? Why not 1?

    I will have my computer randomly guess letters until an A comes up. Then until a B comes up. And then, at the end I'll have the ABCs! RANDOMLY!

    Am I being retarded? Did I miss why this is cool?

  20. Re:Frankly, that's cool by mcavic · · Score: 2

    Unless I'm missing something, this is obvious. If you type random characters long enough, you'll come up with some English words. If you eliminate all of the words not written by Shakespear, you'll be left with a Shakespear play.