The group called themselves ‘Human Terminators’. The members were from various parts of the planet Earth. The communication technology had enabled them to come into contact with each other. They were passionate about the same idea. To be successful, they felt every other human needs to be killed specially the kids, the old and those who were not willing to try their idea. And, they achieved their mission. But, the bigger mission still awaited to be done. They built a huge building which housed the only surviving 2,00,000 humans. It was firmly believed by them that a computer simulation was responsible for running of human lives. Things happened randomly in the lives of humans. Humans had no control. Humans will never achieve happiness, equality for all. So, better to destroy this simulator. And, they felt to defeat randomness they needed to do everything at the same time for 24 hours – wake up at same time, brush at same time and for same length etc. And, the simulator will die and so will the human species. So, on 24th September, 2316, they started practicing synchronization. They woke up at 5 a.m. Then, started brushing for 5 minutes at 5.01 a.m. and finished at 5.06 a.m. They were able to synchronize many activities.
But, they failed to synchronize the timing and length of finishing their toilet routine. The failure continued for 3 months. Some got very frustrated and committed suicide. In the end, ‘Human Terminators’ gave up.
End of fiction
Saga – a heroic narrative
I first coded in python in October 2009. I had an idea for a chess website, and decided to try out Django. I had coded a fair bit in Ruby, and explored rails too. So, the dynamic aspect of python and magical qualities of Django did not overwhelm me. It took me just 7 days to launch the website. The users could solve chess combinations. So, I consider it a small success. But, then I did not take the site any further. Now, in the beginning of 2011, I came up with the idea of adding a new feature – Solitaire Chess. This time around, I had to dig deeper in python. And, these are some of my learnings -
TypeError: ‘module’ object is not callable
I needed a class which would generate FEN string, based on the position on the chessboard. Now, FENgenerator.py had class FENGenerator. The module name is FENgenerator(the name of the file itself). I imported “FENgenerator”, and tried
to create an object, FEN = FENGenerator(), and got the above “TypeError”.
In python, everything is an object, including a module.The above import statement, does not import names in the module. So, to create an object, I had to do – FEN = FENGenerator.FENGenerator
The scope of variable “pleasant shock”
The code –
if matter == "Urgent":
givep = "yes
givep = "low"
I was able to access a variable declared inside “if” block”, outside the “if” block
__init__.py required for your module to be seen
Session variables can be used in templates (Django)
easy_install is equivalent of rubygems
easy_install django-extensions -> downloads all the packages from an online repository
I used TDD approach to develop FEN generation logic. My first exposure to tests in python. Each test method has to start with “test_everything_is_ok”.
Checkmate. And, the game was finally over. The game had lasted for 6 hours. For those 6 hours, Jay was in a different world. He was in a zone, unaffected by the life he lived; the life which was better ignored. The game, was the only thing that mattered. Jay, was feeling a bit disappointed but there was a strange calmness within him. Why so? The game saw both the players getting an advantage at different moments, but were not able to convert into something meaningful. And, then came the endgame, which involves slow maneuvering of the pieces. Jay, enjoyed the process of planning, predicting, being surprised by opponent’s moves, and finally getting out-maneuvered. And, he was ready to play the next game in the tournament. In life everyday is a struggle. Somethings workout, and some don’t. But, if we accept both with the same equanimity, then the journey is joyful.