Tumbbad — A Coder’s Perspective
Tumbbad — A Coder’s Perspective

Tumbbad — as seen by a coder

Punit Kanuga

--

Over the last few weeks, I was between jobs. Coronavirus pandemic made sure that I stayed at home, and added to the time I had. I ended up doing what most of the coders have done in this time. I refreshed a few concepts and watched a couple of movies (along with doing the dishes and cooking once in a while). Interestingly, this let me correlate things between the world of movies and coding. I couldn’t wait to share these fun thoughts. So here it goes.

Tumbbad, a 2018 India movie, is a story about a hidden treasure. This treasure is guarded by Hastar, the greedy God of money, who has an eternal hunger. When one wants to collect gold coins from this fallen God, they would tempt him with a doll made of wheat. The seekers would collect the gold coins till the God feasts. As soon as God is done eating, it would attack people who were seeking the treasure. In short, it’s a classic optimization problem.

Now as I was refreshing the concepts of Computer Science, I realized that Hastar was doing the same since eternity. Alas, it wasn’t known to the protagonists, cause computer weren’t invented for the human world till then, duh!

First of all, the fallen God has its Priority Queue sorted. His top priority task is to eat. If there is nothing to eat, it would attack anyone near him. If there is no one to attack, it would sleep.

Hastar’s Priority Queue
Hastar’s Priority Queue

Thanks to this clear prioritization of tasks, our cute little Hastar was in a happy place, and was sleeping in its mother’s womb. Not to mention, its peace of mind is coming from the fact that he secretly wears a special hat, which helps it in sorting its life priorities. Thousands of years later, this hat would become famous as the Sorting Hat, and has also featured in the Harry Potter series to sort the little magicians in their respective houses. Had Hastar wanted to monetize its legacy, EAT-ATTACK-SLEEP-REPEAT would have been it’s trademark. However, it is the God of money. So it doesn’t give a damn about earning a bunch of nickels.

The Sorted Hastar
The Sorted Hastar

Disclaimer: It is really important for me here to clarify (since Hastar didn’t file a copyright for this) that the copyright for the above resides solely with Mr Paul Heyman. Obviously, who would want to be on his bad side, especially when he has former UFC champion, Brock Lesnar, by his side. Who would want to mess with him? Virat Kohli didn’t. Ranveer Singh didn’t. How dare we?

Heyman Hails
Heyman Hails

Now that we have legalities out of the way, let’s move back to the movie. In the climax, the protagonists try to collect more gold coins from Mr Hastar Goldman by tempting him with many wheat dolls. They believe that the fallen God would take more time to eat those delicacies, which should give them ample time to collect more gold coins.

In a nutshell, they want to tweak Mr Hastar’s personal (coders please read private) Priority Queue with many ‘EAT’ so the God doesn’t get enough time to ‘ATTACK’. Even if Hastar keeps on Dequeuing ‘EAT’ tasks, ‘ATTACK’ and ‘SLEEP’ tasks would starve! Ironic, huh?

Would EAT tasks starve the other tasks?
Would EAT tasks starve the other tasks?

At this point to time, Hastar is puzzled with the unprecedented load on his Priority Queue. Furthermore, he is wondering how the two outsiders have access to his private Priority Queue. It is guessing that the protagonists are familiar with the secret concept of Reflection.

However, those humans didn’t know that Mr Hastar, the ancient Geek, is an expert in Multi-Threading. It soon creates multiple copies (read threads) of him and starts to feast on all the wheat dolls.

Thanks to Multi Threading, Hastar pulls this one off

Now the tables have turned. Not only, God has feasted on all the food, but also his multiple instances are now all on the attack mode as there is no food left! How are the protagonists going to save themselves? Which computing concepts would come in handy for them? Stay tuned for the next article as the protagonists prepare for their final round of interview. Till then, keep hustling, keep learning, and most of all Stay Safe!

--

--