It’s a word you’ve probably heard, and dismissed as being too many syllables to understand: “algorithm.” There’s no reason to fear however; you know what an algorithm is. I promise. I’ll just have to show you that you know before you know you know (trust me, I know).
Let’s start with an easy example I know you know you know: The Pow Algorithm.
(Note: in all that follows, the object MBBI is defined as follows.)
function Pow_Algorithm(var_arg_in) 1 IF snow_total_nearby() >= 10 2 find(location(snow_total_nearby())) 3 drive(location(snow_total_nearby())) 4 WHILE group_morale() >= cranky_pants 5 ascend(location(snow_total_nearby())) 6 descend(location(snow_total_nearby())) 7 WHILE pow_in_face()=1 8 hoot() 9 hollar() 10 giggle_like_little_kids() 11 END 12 IF num_MBBI() > 0 13 pop_MBBI() 14 END 15 END 16 END END
As you can see, this algorithm–or program if you will–tells one what to do when powder snow arrives nearby in quantities greater than 10 inches. Of course this is only pseudo-code, and a computer would be hard pressed to run this algorithm (mostly because computers don’t like skiing; in fact they don’t like anything; they have no consciousness [more on that at a later date]).
Another example is the code that your GPS-device writes for you to follow to get you lost when you want to get somewhere. It’s sad really. I’m crying right now thinking about the irony of this algorithm.
But not all algorithms involve tears. Here’s one that we wrote recently, and so I’d be surprised if you are familiar with it. It implements Pow_Algorithm() as a subroutine, so it’s a good third example for beginners. We developed this algorithm last week when Lake Ontario decided to unload its contents on surrounding environs. Here’s the code:
function Ontario_Pow_Hunt(var_arg_in) 1 let_Hutz_drive_angrily_as_friends_fart_in_newly_cleaned_upholstery()
3 Pow_Algorithm(Day_1, 12_inches, lots_of_energy, only_group_skiing, lots_of_MBBI)
Leave a Reply