top of page
Writer's pictureKJ Ha

Infinite Monkey Theorem


The Infinite Monkey Theorem is a theorem that has inspired me for a long time. In short, the Infinite Monkey Theorem states that give an infinite amount of time, a monkey would almost surely produce a complete literary work such as Shakespeare's Hamlet by hitting keys at random on a typewriter keyboard. Earlier in the semester, I created a sketch in a similar logic (https://editor.p5js.org/kh1785/sketches/E_GVozBby) and I chose to develop the sketch using the RiTa library.


Excerpt from Hamlet:


For this project, I chose a line "I must be cruel only to be kind." and decided to create a sketch that generates random sentences based on this particular sentence. To generate random sentences, I took the words "I", "must", "cruel", and "kind" and designed random words to replace them using RiTa.randomWord(). First, I dissected the sentence based on the part of the speech.


I => pronoun

must => auxillary verb

cruel => adjective

kind => adjective


To replace the word "I", I tried to use a personal pronoun ("prp") from Penn tags; however, it gave me words like "oneself", "theirs", "me", "he", "us" rather than "I", "you", "he", or "she." Moreover, for the second word, I aimed to replace "must" with other auxiliary verbs but I could not find a tag that is for auxiliary verbs. Thus I manually created arrays for the first and second words and randomized the order of the array using the random function.



For the fourth and sixth words ("cruel" and "kind"), I was finally able to use RiTa.randomWord(). I limited the number of syllables to be one or two in order to have a higher probability.



Lastly, I reduced a frame rate into 6 frames per second so that the changes will be more recognizable.


Here are the sentences generated by the sketch:


He tried to be dim only to be slow.

We cannot be plaid only to be deep.

They aimed to be sore only to be jagged.

You cannot be worse only to be vague.

I must be ribbed only to be odd.

Comments


bottom of page