2021 icon indicating copy to clipboard operation
2021 copied to clipboard

A Finite Number of Monkeys

Open savetz opened this issue 4 years ago • 2 comments

This NaNoGenMo book is "A Finite number of Monkeys", weighing in at 61,339 words.

The code is in python. There is a "target" paragraph that the monkey needs to match, but the monkey can't read. He starts by typing random characters. If any of those characters is in the correct location, he is alerted. The next attempt, he'll leave the correct characters in their correct locations, randomly retrying everything else. Over time, he figures out the target paragraph.

Spoiler: in this version of the story, the monkey finishes the job in 750 attempts. I ran the program 150,000 times: the monkey's fastest time was 315 attempts. The slowest was 1514 attempts.

The book: monkey.txt monkey.pdf

The code: monkey.py.txt

savetz avatar Nov 01 '21 14:11 savetz

I'm adding this sample so I get that sweet, sweet "preview" tag.

On day 191, the monkey typed:
Tomor3ow, and tomorrow, and Eomorrow, Creep; Nn thi^ petti paceefrom day to daK, To RhH last sylla[ld of secordFd
 time; And allbou/ yes7er?ayp have l5ghted fools The way to d(s)y death. O-t, iut, brief tandle! Life'A@but a O.l[inJ
 0hado4, a poo; player, That 5tuuts an0 freimwhis{hwur upon thy stpge, And then /s k[ard no moie. ot is a r@0  ,old
Ty an idiot, Eull of7sound a?dkfury, JiPnifyin. nothing.
A little bell went ding! and the monkey received 3 treats!

savetz avatar Nov 06 '21 17:11 savetz

Hi ! I really liked your submission. Congrats!

cenybar avatar Nov 09 '21 19:11 cenybar