Infinite Monkey: Part Two

Saturday, August 23, 2008


Its been an extremely boring day at work so far, so I had plenty of time to crack open my editor and do a good bit of in-the-dark programming on my Infinite Monkey Development idea, which I can safely say is going to be the most horrible code I've ever written, bar none! For those that don't believe its as bad as I say, stare in horror! Having to think longer about each line of code since I was only ran perhaps two tests of the code I wrote before going to the blog to share the horror with the world. There are some glaring issues with that code as its incomplete at best but the real thing is what I learned about the whole process.

For starters PHP is extremely unhappy when I attempt to trick it into printing the traditional opening tag and so far I haven't figured out how to do this, of course that really is something I shouldn't be focusing on just yet. Initially I wanted to keep this as dumb as possible in terms of decision making within the code for the sake of keeping it as close to random as possible. Unfortunately there needs to be some logic in place to manage the knowledge of what each randomly selected function requires in terms of arguments and in what fashion the output is. While this of course seems to violate the idea of keeping things random it ends up being balanced out by randomly selecting the input data and also using rand() to determine what line receives the output data to further process.

Another problem that is plaguing my mind right now is how to determine which functions to put into the pool of possibilities; if I allow too much thought on the process it will undoubtedly diminish the overall goal of the project. However on the flip side things like database connections, drawing graphics, etc would complicate the code so much as to make it near impossible for it to even produce source code let alone be efficient enough to generate results that can be analyzed and examined. I suspect that with my limited programming abilities the initial options will have to be limited to the standard functions that typically deal with math and string manipulation, however there is a chance I can rope other friends into the project to expand the pool of possible functions to be used.

So to sum things up the future for this particular endeavor is looking quite interesting if not at least fun and education as a former roommate would say.

Labels: , , ,


posted by dword at 12:30 PM | Permalink | 0 comments

Randomly generating source code

Thursday, August 21, 2008


So this idea has been circulating in my mind for at least a few weeks now; if you wrote code that spit out source code randomly how long would it take to come up with something that actually works and more importantly what would it do? This of course is basically derived from the Infinite Monkey Theorem which states

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.

I've been doing some preliminary work on figuring out the logistics of actually generating random code and of course first i have to have a way to collect and hold a large amount of data - namely some or all of the functions in the desired language, in this case PHP. A daunting and likely resource intensive task lies in front of me starting with building an array of every PHP function in their documentation.

From there I have a question I need to answer in terms of direction for this endeavor, namely how random is random enough? To put a finer point to things I have to decide if storing the types of arguments that each function requires would remove too much of the sense of hit-or-miss from the project by eliminating a decent portion of potential errors. Passing only strings to a function that needs say an array, maybe a Boolean and perhaps a hand full of integers as well would no doubt send the interpreter screaming into the void of error. Since I'm doing this for the pure fun of it I don't have to satisfy some outside force's rules and regulations so naturally I'm leaning towards keeping specifics of what arguments each function needs, the arguments themselves can still contain random data of the proper type to ensure things are still a crap shoot.

All the technical talk aside the concept of randomly generating source code interests me because unlike brute forcing a password the outcome is mostly unknown; when using this approach on passwords you keep throwing stuff at the problem till you find the right combination, in the case of Infinite Monkey Development (if I may be so bold as to mutilate the phrase) you are throwing code together until something sticks in an at least semi-coherent fashion. In all likelihood the output code will almost always be total junk and not even parse correctly let alone run and do something that I could comprehend. That is not the point however, the idea is to keep running with it until something is born out of the primordial soup of segfaults, parser errors and other miscellaneous screw ups. Whatever is born will no doubt be gimped at best but it is something that can be worked with, studied, refined and ultimately exploited hopefully for the profit of all mankind or at least myself!

Labels: , , ,


posted by dword at 4:51 PM | Permalink | 0 comments

Full of Fail

Saturday, August 16, 2008




So I stumbled across this gem while aimlessly surfing at work and I must commend the original designer of such a creative work of art. By adhering to the KISS principle the creator manages to prey on the overwhelming majority of internet users: Complete Idiots! Now for anybody reading who had even entertained the slightest thought of actually putting their number in please do the world a favor by stepping in front of a moving bus and removing yourself from the gene pool. Seriously anybody stupid enough to fall for this should immediately stop with the theft of my oxygen, its just ridiculous that things like this have ever worked and even more so that they probably still do have a reasonable success rate.

Labels: ,


posted by dword at 1:41 PM | Permalink | 0 comments

The Great Devourer

Friday, August 1, 2008


it really is that bad!!!

Inspired by my friend who grows gray hair dealing with Dell

posted by dword at 8:48 PM | Permalink | 0 comments