Tuesday, September 22, 2009

Classification of detective stories

Almost all whodunnit stories fall into one of the following story-o-types:

Setup: V is a victim who dies. D is the detective. X, Y, Z ... are the suspects. The killer K must satisfy K ϵ {X, Y , Z ...} U {D, φ, V}.

1. The least obvious suspect did it: This trick is used so often that it has become almost a cliche. Y is meek, good and helpful. Y seems the least likely to have carried out the murder. In the end though, Y is revealed to be the killer.

2. The most obvious suspect did it: As people read more and more novels which use trick #1, they start suspecting such unlikely characters. A clever writer reverses this by making the most obvious suspect the killer. The problem with this is if the reader hasn't come across trick #1 very often, the ending will fall rather flat.

3. The victim did it: No one suspects the victim, by virtue of the victim being dead. The ending reveals that the victim intentionally killed themselves, thus confounding everyone.Cards on the table is a good example of this trick.

4. Everyone did it: People instinctively expect only one of the suspects to be the killer. If more than one suspect were in collusion, the reader is much less likely to deduce the culprits. The most famous example of this is of course Murder on the Orient Express, where every suspect turns out to be the killer.

5. No one did it: There never was a murder: it was all an accident. Like trick #3, the reader feels a bit cheated since the perpetrator isn't brought to justice.

6. The victim is the victim: V is supposed to die, but W dies instead. The ending reveals that W was the intended victim after all. The ABC murders is a perfect example of it.

7. The fake victim did it: This takes trick #6 to one more level; not only is W the intended victim, the fake victim V is the killer. The Mirror crack'd from side to side is a good example of this.

8. The detective did it: This obviously doesn't work if the detective is famous. Also, for this to have a satifying ending, there has to be a second detective who reveals the killer. Bonus points if the story is being narrated from the detective's point-of-view in first person.

9. The butler did it: I just had to put that one there :D

10. Unexpected Motive: Given that the choice for 'who' is pretty limited, the motive is the factor writers get to play most with. Again, The Mirror crack'd from side to side is a brilliant example of a motive for which enough clues exist in the story, yet is very surprising in the end.

11. Unexpected Method: 'How' is the thing writers let their imagination run free over. The most interesting ones are the "impossible murders": murder which happened in a room which was locked from the inside etc.

Monday, September 14, 2009

Handling memory leaks

I found this gem in some code I wrote in 2003. This, ladies and gentlemen, is the proper way to avoid memory errors.

//////////////////////////////////////////////////////////////////////
/// Extremely Dangerous to do this , but the app keeps crashing
//////////////////////////////////////////////////////////////////////
void SigSegVHandler(int __SigNumber){
return;// I am ignoring all Segmentation faults
}
int main(){
signal(SIGSEGV, SigSegVHandler);
}

Tuesday, September 08, 2009

Guess the plot: B-grade horror movie edition

In this age of internet porn and big budget 3D horror movies, the subtle art of the B-Grade Movie is indeed lost. They were the true pioneers of their time, pushing the boundaries of the U-rating by showing almost-but-not-quite-naked women in close-to-but-not-really-scary situations, with the silliest names anyone could ever imagine.
I found some posters of some such gems recently, without any other info about their plot. So here is my take on the movies based just on the poster.

Bhaago Bhoot Aaya

Usain Bolt produces and stars in this classic tale of murder, revenge and running. When Shaitan captures Bolt's girlfriend, he challenges him to the ultimate race. Now Bolt must run like he has never run before: being chased by ghosts and while wearing formals.


Kabrastan

To the east of Kazakhstan and to the north of Uzbekistan lies a small forgotten country called Kabrastan. For some reason everyone there is dead. After Borat succeeded in introducing the fine culture of Kazakhstan to everyone, some Kabrastani director decided to make this movie. The protagonist of this surreal movie is a hand which talks. Some believe that hand is a metaphor for the Congress party which is why Sonia Gandhi banned this movie in India.

Pyasa Shaitan

Thie movie is notorious for it's product placement: the people in this movie keep drinking Coca-cola products throughout the movie. The Shaitan doesn't actually kill anyone because he's too busy drinking Coke Zero. There is a token girl-who-dies in the movie, but thats because she drinks Pepsi accidentally.

Khatarnak

A heartwarming musical adaptation of Michael Jackson's Dangerous. A touching story of a one-eyed cyclops' struggle against the bigotry of the carnatic music world. The protagonist is a monster who's ambition is to sing Dangerous in yamuna kalyaaNi raaga, but is thwarted by jealous and petty humans. In the stirring climax, our hero butchers an entire kacheri full of people while maintaining taaLa.