Wednesday, April 9, 2008

"That's only entertaining the first million or so times"

So I'm reading this book, Effective C++ Third Edition by Scott Meyers, and I came across a bit about overloading operator[] with const and non-const versions and getting the non-const version to call the const version to avoid code duplication. This involves a couple casts to make it work right without calling itself recursively, so at first glance it seems odd. Frankly, the section was hilarious (also accurate and helpful, thanks Mr. Meyers!), so I laughed out loud for a bit. Then I thought of trying to explain why I was laughing at it to a non-programmer such as my three family members who read this blog, and I laughed even harder.

Then I decided it had to be done(, clearly).

Ah, recursion, how I love it. I remember when Joe Cygman taught recursion to our class in university, the first thing he said was that when dealing with the subject he was about to teach, it often helps to drink heavily beforehand. Frankly I don't think it is all that hard, but Joe is an amusing guy. (Also, favorite teacher ever. Just for the record.) Anyway, not that recursion is inherently funny, it was mostly Mr. Meyers' writing style (the title of this post is the quote from him that made me laugh, just so you don't think I'm claiming credit for writing something funny. Saw the quotation marks, did you? Those are my clever way of saying I didn't have an original thought to put on that line) in reference to a code path that causes a program to sit there spinning in an infinite loop, which is generally a bad thing =P

On a completely unrelated note, I thought I'd share some amusing video game moments.

Dungeon Siege II

After rescuing three squad members from a monster infested fortress and returning to their commander, Squadron Leader Taarth has this to say when he rewards you: "Thank you for rescuing my men. Most of our spare gear is destroyed or unreachable, but we found this dusty key under a rock. I'm not sure what it opens, but perhaps you will find it useful." ... Naturally, the key is a crucial to a later quest :p Either the quest designer was being really lazy or really sarcastic about the nature of RPG quests in general :) I'll go with door number two, Bob.

Dungeon Siege II: Broken World

Upon defeating the ultimate villain (oh no! I'm going to spoil what happens, quick, if you're going to play this, change the channel before you read the results out of your peripheral vision! woops, too late) he raises his arms to the sky, shakes his fist and yells "You cannot beat me! I AM ZARAMOTH! This is impossible! NOOOOOOOOOOO!", then his chest explodes, then a huge stalactite formation falls from the roof and crushes him to a bloody pulp. How over the top can you get? Also, if the game designers really thought they were being dramatic and not hilarious, this becomes sad and even funnier and the same time!

Guitar Hero II:

At the end of career mode, the audience starts chanting "Free Bird". The game asks you if you want to go out and play the encore. If you say yes, it asks if you're really sure, because Free Bird is something only a true guitar hero could pull off. If you say yes, it says are you really really sure? Its really hard! If you say yes again, it warns you that this is your last chance, and that Free Bird should not be taken on lightly. If you say yes again, it says "Wow, you must really like Free Bird" then lets you play it.

I don't know what happens if you say no to any of those questions. Only wimps say no!

p.s. Yes, it has been around 5 weeks since an update. This begs the question, did I generally update more frequently while traveling or since the return to Canada? hmmm.