Elektor Team

Now Monkeys Can Program Too

December 10, 2013 | 14:37
Now Monkeys Can Program Too
Now Monkeys Can Program Too

The infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare. In this context, […] the "monkey" is not an actual monkey, but a metaphor for an abstract device that produces an endless random sequence of letters and symbols. [Source: Wikipedia]


Shakespeare’s works or a computer program are both constructed from individual characters, so it should be possible for the monkey to come up with a working computer program too, right? It seems simple enough, but in reality it is a bit more complicated. To simplify the problem, a rudimentary programming language called brainfuck consisting of only eight (unreadable) instructions (><+-.,[]) was chosen and a computer was set to work to evolve randomly a program capable of outputting the text “hello world”.


It only took two hours and 580,900 iterations to get the job done. You could probably do it quicker, but the result is impressive anyway!


Read the details here
Loading comments...
related items