How To Play

The goal of the game is to write the entire first a of the first act of Shakespeare's King Lear, one random letter at a time. Monkeys will type letters at random until one hits the correct one, and each completed letter gets you $1. Use the buttons on the top floor to hire more monkeys and motivate the existing ones to work faster by buying posters and banana trees. Toggle the music and sound effects by clicking on the radio.

I highly recommend giving the write-up below a read while you wait for your monkeys to progress.

Infinite Monkeys on Infinite Typewriters

This game is based on the Infinite Monkey Theorem, which posits that a monkey on a typewriter, if given infinite time, would be able to write any complex piece of literature, such as Shakespeare's King Lear. In I̶n̶finite Monkeys, your monkeys will have to type the entire first scene of King Lear - the length of the text is part of the absurd premise; I don't actually expect you to complete it all.

Though I do some really basic statistics below, I avoided all the very technical stuff like the formal proof of the theorem. Because if you've been on pop-science YouTube, you'll know that even though it's better for proofs to treat the monkeys in this theorem like uniformly random string generators, it's much more fun to just calculate big numbers and talk about monkeys.

Finite Monkeys?

While planning this game, I wanted to make the description and premise somewhat dorky. The initial concept was to simulate a "true" version of the monkeys-on-typewriters experiment, with multiple rounds of guessing, and I wrote some test code for doing so (knowing that it wouldn't end well). A monkey would guess random words of length N until it got the right one, then a round would start for N+1. So on round 1, if the word was "A", it guesses "K"... "B"... "G"... "G"... "A"... okay! Now guess "UE", then "JHW" and so on. 

The problem? Runtime. When you get to N=5 and above, the simulation becomes very slow. If we equate what the monkey in this example is doing to something more realistic, like password-guessing, it becomes clear why. If a human were guessing a 5-character password, they'd be foolish to guess the word "BEANS" once, only to guess it again a little while later. They already know the password isn't "BEANS"!

Monkeys aren't so smart, because the idea behind the experiment is that their actions are (in an abstract sense) random, or rather, any previous action has no bearing on the next in any meaningful way. This means that the "monkey approach" to password cracking is much worse on average than a brute-force attempt.

So even for tiny guesses of five characters, the program would sometimes run for much longer than it should have, because every attempt is a purely random guess. I knew the complexity would blow up very quickly, but the degree to which it exploded was a surprise - primarily because of the random element. Similarly, in I̶n̶finite Monkeys, you may notice that there are occasionally long stretches of time where no correct letter is hit, even with fast typing speeds. Fully random guesses are, generally, bad guesses.

King Lear, Act I, Scene I

Now let's use King Lear as a more specific example, because the numbers are big and that's just more fun. The first scene in the manuscript of King Lear used in this game is 14326 characters long (the entire play is 150746). All sections of whitespace are replaced with only a single basic space character, and all letters are treated as uppercase. The punctuation symbols {. , ' : ; ? -} are also included. 

So, suppose we had a single monkey which would generate purely random strings of length 14326 over some period of time, at which point we'd compare it to King Lear and give the monkey a thumbs up or (much more likely) a big ol' thumbs down.

Given the previous discussion, you may guess that it would take a few attempts. This is the reason why the thought experiment proposes "infinite" of a few resources. It varies, but this usually includes infinite time, monkeys, typewriters, and presumably zookeepers (so the monkeys stay in their seats). 

So, how many possible strings of length 14326 could any given monkey generate in one attempt? Well, if we confine the alphabet to what appears in the correct full text, each character in the random string can be one of 34 characters (26 letters, 1 space character, and 7 punctuation marks). Now, for each character in the string beyond the first, we multiply 34 by itself to get the total keyspace of the 14326 character string.

The number of possible strings the monkey could generate is a whopping 34^(14326). That's a decimal number that's 21940 decimal digits long . For more context, there are approximately 6 x 10^(79) atoms in the universe, which is still less than the number 34^(53). Now multiply that number by 34 again, then do that another 14272 times.

Out of all those possibilities, only a single one is the true first scene of King Lear. So it's probably fair to also assume that the monkey must be immortal for this whole operation to get off the ground; it's going to take them a while.

A Practical Compromise

Now, back to the game, which is probably still running as we speak, because half of the joke is that it's annoyingly long. I think I've made a case for why it isn't just a single chimpanzee in an armchair yelling random letters until one is right... because you'd be here until the heat-death of the universe waiting for divinely-primate-generated Shakespeare, even just to get that first act.

Instead, there's an obvious solution that makes things a bit more tolerable: make the monkeys less Darwinist and more collectivist, by which I mean they work together, and mistakes are ignored. I mean, we were already checking the output against a copy of King Lear in the last hypothetical for correctness anyways, so is writing it a letter at a time really cheating?

The answer is "yes", but again: waiting until the end of the universe certainly can't be any more appealing. It's much more interesting to watch monkeys hit things.

PS: if you want to support my future projects, check out my current game in development: VSCS-II. Thanks!

Updated 3 days ago
Rated 4.3 out of 5 stars
(26 total ratings)
AuthorSkullbutton Interactive
GenreEducational, Simulation
Made withUnity
TagsAnimals, Funny, Idle, Math, monkey, Pixel Art, random, sitting-simulator

Development log


Log in with to leave a comment.

Well....I've complete it today as well, took me maybe an hour or two?

i was expecting a little more fanfare for finishing the game… :(


What about making the game wider with more rows of monkeys to be bought, same with the posters and trees updates. and put the entire book or just chapter 2 as an update.


That would be cool


Love this so far! 0.4328% of the way through and going strong. Great idea!


to be honest make another game using monkeys as lumberjacks because the speed of their arms is really fast




I wonder how many people actually beat the game ...?


Well now there is one more :-)


It's technically possible to get every letter on the first try.

That depends on how the random number generator works. Generally there's a relatively small number of seeds you can start with, and if there's nothing the game uses rng for besides the numbers the monkeys pick it will always pick the same series of letters from the same seed, so regardless of what seed it picks it won't be able to get all the letters on the first try.


monk y


The more you upgrade, the more satisfiying it becomes!

Great, fun and original for an idle game!


new idea

lorem ipsum

Hm. Feel like I may have missed a point somewhere along the line.


This is perfect.



That's a remarkably thorough writeup for a game where you buy motivational posters for monkeys.  (No one ever talks about the infinite zookeepers!)

I can think of things you could add to the game.  For instance, I went away to take out the garbage, and when I came back, I had missed several words!  So perhaps a button where you can review the script as they have it so far.  Or: I wonder what would happen if, each time a monkey gets a letter right, they have a slightly better chance of getting that letter the next time it comes around--not an overall improvement, just a stimulus/reward so that now they know what's expected when they see an "A".

But those would be additions.  I can't think of any way to improve this game, because it's a game about monkeys typing Shakespeare letter by letter, which makes it perfect as it is.


...The game gets stuck once it hits the square brackets.


Fixed! Thanks for the heads-up, I forgot to check for some punctuation. Sorry about the trouble!


Thanks! It works now :)