Do you remember what the famous Snoopy calendar is? A little help: “The typical Real Programmer lives in front of a computer terminal. Surrounding this terminal .. a line-printer Snoopy calendar (For the year 1969) is taped to the wall.” Today I read the Real Programmers don’t use Pascal again, and this tiny little detail caught my attention. When I was child, I read the Hungarian translaton of the Real Programmers.., but the Snoopy calendar wasn’t mentioned in that! Maybe the translator didn’t know what Snoopy calendar is or he/she just thought that it is not an important detail. Well, I don’t agree with him/her. “There is nothing so important as trifles.“
I decided that I rewrite the Snoopy calendar in C/C++. And why? Do you think it is heresy? Is it pointless? The Fortran codes are available here and here, I can compile it in ten minutes, I just wasting my time? Well, you are right. But I wanted to feel the passion, I wanted a quick C++ project (the development of the C++ Snoopy calendar take about 6 six hours), and I wanted to compare myself to these so-called real programmers.
After this project, I have to admit that these guys are much better than me. First I copied the numbers and the words of the months and the thirteen pictures from the 1969 Snoopy calendar, after than I wrote an RLE text encoder/decoder, I tried to recreate the original output character by character, then I took the logic of a perpetual calendar.. yes, it took hours. At the end almost everything looks fine. (Okay, there is a small bug: the program prints 133 characters into each line, not 132 characters..)
My code is organised, but it is not so brilliant as the original Fortran code. The original code is smaller, more succinct, faster, more optimized, it can print single months too. My compiled C++ program is about 50 kbytes and I didn’t wanted to print single months, my goal was to reprint the original pictures and keep the structure with updated day and date values. I wanted to dust off the calendar, I wanted to see how a perpetual calendar works. I created a pdf file from the output, I printed it and I will use it as my wall calendar.. (The pdf file is included to the project.)
I don’t have a Snoopy Calendar dated from 1969, because I’m not a real programmer. (You know, yesterday I eated quiche.) But I respect these great guys, I remember them and I try to follow the Way of them. I need the 2012 calendar, because I live my life in the present, and I need a Snoopy calendar, becasue I want to feel the “the spirit of Real Programming“.
You can download the complete project here. (Linux/GCC, sources included!)