Search

Archives

August 8, 2005

Program Self-Reproduction

I got an email assignment during work from a friend to write a program that outputs its own source code. It can't have direct access to the source file(s), which means no reading in and then outputting the source directly. So I spent a good chunk of my afternoon working on that nonsense, and finally came up with a short python script to do the job (though the syntax is easily converted to Perl or C).

After I came up with the solution, I did a little searching to see if anyone else had attempted to do such a foolish thing. To my surprise, it seems like this is a fairly popular mini-hack that bored programmers (like myself) do for amusement. Actually, it can have applications if you are writing self-propagating virii, but everyone knows I wouldn't do anything like that (the crowd hears evil cackle). A quine, as defined, is a program that generates a copy of its own source text as its complete output. My quine had the same structure as most of the quines that I came across, so unfortunately, it's not terribly original. I can imagine there being some pretty obfuscated solutions in Perl or Javascript, but I think I've had my fun with quines for now.

After I got bored playing with my reproducing code, I made significant progress on my wireless research. I've been working on writing classifiers for wireless frame data, and I finally have something that should reasonably and efficiently do the job. Our project started with such high hopes, and just took one failed turn after another. Well, that's the theme of all good research though right? Now I have only 3 days left here, and success is just within eyesight! Luckily, there are two guys that will still be around to finish up writing code and testing, and I should be able to help work on a paper of our findings remotely. Adding that to the writing I'm doing on a distributed traffic correlation system, I'm just looking forward to when school starts and I can finally take a break!

No comments: