Tuesday, November 30, 2010

Keeping it Simple and Smart

Recently I relearned that making things complicated isn't such a good idea & that a simple solution is sometimes the best one.

A friend came over while I was reading about Nim and he told me about a similar game that he knew of, The 21 Game. We decided to make a program that plays the 21 Game.

While he wanted to just get at it & start coding, I wanted to first come up with a winning strategy. So we had a test run & discovered that if you wanna win then you say multiples of 4 & that the game is biased towards the 2nd player and barring a mistake the 2nd player will always win.

There, we had our winning strategy. So we went on and wrote the program, right? Wrong! Neither of us saw it. We had the answer right there but we were too caught up in our own thoughts to see it. While the friend wanted to go ahead & simple write a program using if-else statements, I was looking for the answer in binary. Looking for a expression that would tell the computer what number to choose. Pfft!

So time went by & we move on to making a List of 100 for our MMORPG project(here).

And while Aditya was making the list, it struck me! 4, say multiples of 4 dammit!!
So, what should've been tackled in 5 mins took me over an hour, just because I was making things too complicated & wasn't seeing the simple answer right in front of me.
I eventually updated the wikipedia entry and scrapped the idea of writing code as it was too simple(I know, I know)

No comments:

Post a Comment