Programs can now write programs; robot apocalypse any day now

Kory Becker

Okay, the title might have been a little bit of an exaggeration; it's our great-grandchildren who should fear, not us. Nonetheless, that doesn't change the fact that having genetic algorithms produce programs of their own is not, in its own way, a thing of rare and inexplicable beauty.

As spotted by Hack a Day, a chap named Kory Becker recently made use of a minimalistic yet Turing-complete language called brainfu*k to create a program that can generate 'hello world' programs. Sure, it's considerably less impressive than, say, making Skynet, but it's still a step in what may or may not be the correct direction.

According to Kory himself, his attempt to create a program capable of engineering programs first began somewhere in the late 1990s when he decided that he could use a variant of infinite monkey theorem could be to create programs. He used BASIC, C, C++, and a variety of other languages in this endeavor, but it was all for naught; the aforementioned languages were simply too complex for automation.

Then, in came Brainfu*k, a programming language that consists of a simplified set of only eight single-byte instructions which can theoretically solve any computational problem in the universe, and things were on track yet again.

Naturally, the whole thing required a fair bit of trial and error. The AI only successfully wrote a program to output "Hi!" after 1,219,400 generations, a process that lasted a little over two hours. It then proceeded to produce the word "reddit" after 195000 generations, and the phrase "hello world" in 580,900 generations.

That said, the experiments are still pretty solid proof of concept. The AI started with zero knowledge of the programming language, after all. If you're curious as to how far you can take the idea, you can find the full source code for this experiment on GitHub.

Get more GeekTech: Twitter - Facebook - RSS | Tip us off

This story, "Programs can now write programs; robot apocalypse any day now" was originally published by TechHive.

To comment on this article and other PCWorld content, visit our Facebook page or our Twitter feed.
Shop Tech Products at Amazon