Can you imagine the source code for a program that appears to be simple ASCII art, but if you run this code it generates the lyrics for the "99 Bottles of Beer" song?
I'm sure you recall the song "99 Bottles of Beer on the Wall". Goodness only knows who invented it, but it's the sort of thing that everyone ends up singing at one stage or another for one reason or another. You know how it goes:
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.
97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
Of course, I'm sure that we all have a little tear rolling down our cheeks at the thought of no more beer, but that's not what we're here to talk about. (Also, I should note that once this song starts rattling around in your head, it's hard to stop humming the little rascal – sorry!)
The point is that I'm on the distribution list for the How Things Work group on Yahoo. Just today, I saw a message relating to the 99 Bottles of Beer website, which is devoted to providing source code programs that will automatically generate the lyrics to the song. In fact, 1102 (and rising) different programming languages and variations are represented.
"What's the point?" you ask. Does there have to be a point? Well, the guy who sent out the message to the How Things Work group notes that it's a more interesting way to compare languages than the traditional "Hello World" program. Good point. It's also a more interesting way to perform a first-pass test of a new system.
There are lots of interesting examples on this site. In the case of Perl, for example, there's a standard version, a minimal version, an object-oriented version, a polyglot version, a "Perl for Romans" version and so forth. But perhaps the mega-coolest offering is the "Eyedrops : Bottled by Acme" version", which appears as follows:
(Click this image to view a larger, more detailed version)
At first glance this appears to be a simple "ASCII art" representation of beer bottles (in fact, someone on the site even posted a comment saying "This shouldn't be here, take it down"). However, if you cut and paste the code to a machine with a Perl interpreter (version 5.000 or later) and run it, it will really and truly generate the lyrics for the entire "99 bottles of beer" song!
I am amazed. I bow my head in wonder. Someone out there is crazier (and much, much cleverer) than I. What next, I wonder?
Questions? Comments? Feel free to email me – Clive "Max" Maxfield – at firstname.lastname@example.org). And, of course, if you haven't already done so, don't forget to Sign Up for our weekly Programmable Logic DesignLine Newsletter.