Saturday, February 20, 2010

The Ultimate Wedding-Attendance Algorithm

Most of us in our age group have been attending friends' or colleague's marriages since sometime now and will have lot of marriages to attend in the near future too. And we are always faced with the dilemma of whether its worth the effort to attend the wedding or not. Like we recently attended a friend's wedding at the far end of the town and by the end of it were left high and dry (I am clearly assuming that 'friend' is too busy enjoying the early fruits of marital bliss to read this post). So as my friend and guru revered Rashmi Mata put it, few factors come into play when deciding whether to attend a wedding. I went ahead and developed a full fledged algorithm for the same: The Ultimate Wedding-Attendance Algorithm.

The basic concept of the algorithm is simple. Its the mind-boggling permutations and combinatorial possibilities of all the factors that makes it difficult to understand and implement than,say the P vs NP Problem. Lets cut out the talk and dive straight in :

/****************Variables****************/
/* global Variables */

you_are_married = 0
// Looks pleasant as long as it is 0.You will know why this is required as we go along

/* Level 0 variables : The most powerful ones. Any of these, if set, override all the other factors and leave you with little choice but to attend the wedding. Carefully set them to zero at the start or face the dire consequences */

is_a_close_relative = 0   
is_a_close_friend = 0
is_your_manager = 0 

/* Level 1 variables : Little less powerful but have more weightage than level 2,3 */

you_are_alive = 1
/* Means you are a ghost and not visible to anyone. Its a good situation to be in when you think about it, coz then you don't have to hide all your way to the stage to escape from aunties who will cast their blood-draining hold on your cheek and tug at it till your "Holy #$%#$% mother of Jesus" agony-filled shriek fills the hall. They would still they not let you go unless you agree to their "Its you next, babbby". Again be careful with this parameter else your life can become a paradox and then self-destruct  */

you_are_zombie = 0
/*Tricky business this, being a zombie. Not that anyone will be idle enough to differentiate between a human and a zombie in an Indian wedding setting(except the  prying elderly aunties, of course and your socially challenged & utterly clueless geek friends ,which you will have if you are an IT Professional like me ). Still its advisable to exercise caution  when you finally get on the dais that you don't bite off the girl's hand or something when she tries to shake your hand. Remember : Subtlety is a virtue of great value */

/* I hope there is no confusion wrt to Level 0 & Level 1 till now. Just as an example, if its your manager's wedding , you WILL attend the wedding regardless of whether your a ghost or a zombie */

you_are_seriously_not_well_or_injured = 0
// My parameter names are self-explanatory   ;)
you_are_giving_an_excuse_of_not_being_well = 0 // Very useful but to be used with caution
wedding_out_of_town = 0

/* Level 2 variables Also called Rash's params named after my friend who originally came up with this idea. Obviously the names will be the same as she quoted. You will learn the resourcefulness of these variables once we reach the algo */

venue_is_far_far = 0
date_is_a_wiikday = 0 // weekday
have_attended_your_wedding = 0
/* the bride or the groom have attended your wedding. Applicable only if  the global variable you_are_married = 1 */


/*Level 3  variables */

pretty_girls_expected = 1
/*Always set to default value 1,being the eternal hopeful. This clearly has the  potential to be at Level 0, but by precisely  measuring the inherent ambiguity of the variable and the fatal effects it could have if given overriding powers, I had to place it at a safe Level 3 where it can do little harm to the individual's brain */

great_food_expected = 1 // Another ambiguous param , which can play with your mind and affect your body

relative_or_colleague_has_been_a_pain_in_the_ass = 0
/*Ethics force you to set it to zero by default. A powerful and volatile variable which can even override "is_a_close_relative" (a Level 0) depending on the situation */


/****************Algorithm****************/

/*Let me be clear when I say I will only be presenting a part of the algo here because the entire algorithm is so complex with its interplay of variables that it will eventually be a lost cause for the ordinary layman for whom its actually made. I will be very happy to share the entire algo with anyone who is interested. Also I have decided to make it open source so anyone can edit or improvise the same.*/

/* I am not going to use Level 0 variables here. Extreme caution is advised while using them. Dont  them unless compulsary */

/*Combination of Level 1 & Level 2*/
if (you_are_zombie == 1 && venue_is_far_far == 1)
/* A special case. If you are a zombie and you have to travel far,
 you would reach months after the wedding considering how fast
zombies walk or the probability of a zombie hitch-hiking */
   {                                                                         
        chill_at_home_and_munch_on_man-wiches()  // like sand-wiches ;)
   }

/*All Level 2*/
if (venue_is_far_far && date_is_a_wiikday)
// Remember its a conditional AND. so all the conditions need to be satisfied
{
     set you_are_giving_an_excuse_of_not_being_well = 1
     go_home_from_office()
}

/*all Level 3*/
if (pretty_girls_expected == 1 || relative_has_been_a_pain_in_the_ass == 0 )
/* Though both are Level 3, considering its a conditional OR
and assuming the if condition is evaluated from L to R,
the control enters the if loop as soon as pretty_girls_expected = 1 regardless of whether the relative has been a pain
in the ass or not */

     go_have_a_blast_ogling()
}

/* As you can see , lot of scenarios in the algo are special cases and hence code reusabilty cannot be a factor. I will not bore you with more code (i know its already a lot :P) Hope it helps you de-clutter your mind on the subject and consequently guarantee more attendance at your wedding too. Hasta la vista!*/