Monday, 28 April 2014

Why I don't like Muslims

Swami Gulagulaananda said:
"I call a spade a spade"

If you came to this post by reading the title - You are one of the following:
  • You are seething with anger, wondering what nonsense is written in this post. You are getting worked up and aching to fire up some comments calling me an insensitive bigot, communal and what not. You are also readying some choice expletives
  • You have adopted a holier than thou attitude and are ready to give me advice on how we should all live together happily or throw words such as "I did not expect this from you"
  • You secretly don't like Muslims and are here to read what I have got to say
  • You are still unbiased and are simply curious to read what is in this post
Once you have put yourself in one of those groups, continue reading... Let me clarify at the outset that I just wanted you to realise that we all belong to one of those categories. But tell me, is what I have said here wrong in any way? Isn't it my prerogative to dislike someone or a group of people? And telling it openly like this is freedom of expression, is it not? You have no say in this matter. Why is disliking a group of people wrong? And why is saying it out loud wrong? Are you beginning to hate me now?

And no, I don't dislike Muslims. I have some good friends and colleagues who are Muslims, some who I even look up to. But I would like you to read on because I want to take you through this post. As you read, you will encounter several suggestions or opinions, think of them as thought experiments and not bigoted suggestions. Therefore, for the rest of this post, drop all sense of morality and sentiments and read it strictly with an objective mindset. If you are unable to do it, please discontinue reading.

The elections of 2014 have brought out several hues of the Indian fabric. I noticed a pattern in the elections - What initially started as Narendra Modi vs Rahul Gandhi vs Arvind Kejriwal, soon metamorphosed into Modi vs Anti Modi. I started seeing several patterns and trends. When asked why you don't support Modi, their opinion has always been the same - "He is communal". And no, this is not a post that is going to "debunk myths" about Modi. Rather, I am more interested in discussing bias in the minds of people.

I noticed that people dislike others because of their personalities. Some even openly call names. I find it ludicrous to watch Congress spokespersons addressing Narendra Modi as Shri Narendra Modiji immediately following it with calling him the devil incarnate. So if we are allowed to openly dislike people, hate people and openly call them names, why are we not allowed to, for example, dislike an entire community? Remember, to dislike a community is different from differentiating a community. You are still agitated, I understand, but please bear with me.

I was asked to not say "Blacks" or "Chinese" out loud on a visit to the USA. I said, alright, what should I call them? African Americans is the accepted term? No! Don't say anything out loud, you will be considered racist. What? Why can't I say Chinese out loud? My friend even deleted a comment of mine that said something about Chinese because a Chinese guy was in his thread. My comment wasn't even derogatory, it merely mentioned a fact. Why? Why are we scared to say some things out loud? What's with all this political correctness? Remember, these were factual statements, nothing offensive. An example would be - Local trains in Mumbai are overcrowded.

But people refuse to say some things in public, or even accept them. Like IITs and IIMs. If you call an IITian or a person from an IIM incompetent, it feels like a great sin has been committed. Say something against a religion and you might even be killed. Try convincing about the possibility of existence of God to an atheist and you will be called superstitious. Try convincing about the absence of God to a devout person and he will call you a lost soul. And the media knows about this - Very often, I see headlines on Times of India like - "Dalit girl raped". When you read the actual article, the rape has got nothing to do with the girl being Dalit. However, people get outraged because there is a connotation that she got raped because she is Dalit. This is the way we think.

You are constantly judged by highly opinionated people around you. The other day, I wrote a post asking if homosexuality is natural. One guy went berserk over it, called me a bigot and many names. Why? Am I not allowed to question touchy topics? You can call me a bigot if I refuse to admit someone to a college for being gay or refusing to hire someone for being gay. Would you call me a bigot for not talking to a gay person or not wanting my son to be gay? Think very carefully about how you are approaching this. And no, I don't have issues with anyone being gay, but think about it very carefully. If someone doesn't like his/her son to be gay, would you call him bigoted? If someone doesn't want someone's son or daughter to marry a Hindu or Muslim or Christian, does that make him bigoted?

I don't see what all the fuss about Modi's refusal to wear a skull cap was about. If someone asked me to wear a skull cap, I would refuse too. I once offered a Muslim friend of mine some prasad, and he refused to accept it. I asked him why and he simply nodded his head. I didn't force him, I didn't think he was being anti-Hindu. He wasn't comfortable with it just like I wouldn't be comfortable accepting Christ into my heart or wearing a skull cap. It's not my tradition, to each his own. If you are comfortable, great. But you should not judge someone else. How can you? Why can't people do what they want to or reject what they don't want to? Isn't it a free country? People can probably understand this in the technical sense, yes, Modi could technically reject the cap - but they linked it to him hating Muslims. Why?

The problem with most of us is our inability to think beyond the first layer. Very often, I see people (many Hindus included) calling RSS a saffron terror organisation. Highly communal, you say. Frankly, my dear friend, I would like to ask you a question. Beyond, perhaps, knowing the full form of the organisation, the "fact" that they are a pro-Hindu Muslim-hating Gandhi-killing group of long-shorts wearing people, what else do you know about the RSS? If you know five salient points about them and you still hate them, you probably have a valid reason to hate them. But it is highly unlikely that you know even one point beyond what I have already mentioned. We are all people with preconceived notions who don't research topics.

Let us pause here for a moment and take a quick detour. Facebook, Google and other companies that provide ads for marketing allow you to choose age groups, gender, location etc. to target advertisements. For example, if you are selling digital watches for men and ship only within India, there is no point in showing that ad to a 60 year old woman in California. How do companies ensure targeting happens? They profile everyone. Profiling is very useful to minimise areas and allow targeting to happen successfully. Now let's get back...

I have observed an equivalent of white guilt developing in India among Hindus. For some reason, people are very hesitant to say certain things against Muslims.  I am willing to bet at least 90% of terror attacks are by Muslims. If you don't agree, pull out all terror attacks in the last 15 years, and read the names of the people. They are invariably Muslims. You might be quick to jump out and say "What about Saffron terror? What about Godhra?" That's part of the 10% that includes white supremacists (irrelevant to India) and other attacks. But you have to admit that most of the terror attacks are by Muslims. Now, if you look at the kinds of people who get recruited for terror attacks, they are always the same kinds - Muslim youth, poor, brain-washed - If I can convince someone that their family will be taken care of very well and they are on a holy mission, they will be willing to go to any length. This is how Pakistani terrorists were recruited apparently. If you are already aware of the kind of people who are susceptible to such brain-washing, why can't we use profiling to narrow down possible recruits? But the very idea of people getting discriminated brings out an outrage among people.

If a strictly vegetarian Brahmin family doesn't want to rent out a house to a non-vegetarian Muslim family, is this discrimination against Muslims or discrimination against non-vegetarians? If this family gave the house out for rent to a non-vegetarian Hindu family, then should the Muslims say that they were discriminated against? If the family gives the house for rent to a vegetarian Hindu family, can the non-vegetarian Hindu family say they were discriminated against? The family is allowed to give their house out for rent to whomsoever they please. If you think this is unfair, you should read this post by Sandeep.

Another interesting point to think about it is, why is it that among so many religions like Jainism, Buddhism, Sikhism, etc. the so called issues with "minorities" and so called "secularism issues" is always with Muslims? Several friends of mine on Facebook who are Muslims are sharing photos that are attacking Hinduism, sharing quotes of that moron Zakir Naik - Why? I also see people commenting on various Facebook pages that Shariah law needs to be brought into India and that that is the only solution to all problems.

To summarise, empowered by my freedom of expression, I should be allowed to say whatever it is that I want to say. I don't want to live in an Islamist country like Saudi Arabia where women can't drive and are supposed to wear Burkhas. German chancellor Angela Merkel and UK Prime Minister David Cameron have called their countries Christian. Saudi Arabia, Iran, Pakistan and others are strongly Muslim countries. I want to call India a Hindu country where every other religion is welcome to stay and live with us. Hindus are very tolerant and India will remain a secular Hindu state with no discrimination against any community. Remember, this kind of diversity is possible in India because of tolerance of Hindus. This is my opinion. Vande Mataram, Jai Hind!

Do you believe in secularism?
A lot of people think saying that you are secular is fashionable. If you believe in secularism, you should believe in the following:
  • India should have uniform civil code - same set of laws apply to every citizen, no matter what religion, caste or whatever other differentiating factor you can find. One rule for all
  • Say no to reservations and quotas. You are cheating the bright minds by giving seats and jobs to less deserving people simply because they belong to some caste or religion
  • We need to control population to prevent loss of resources and prevent demographic seige. This needs to be enforced by the government.
  • And spread this openly. It is not okay to believe in something and being quiet about it. True secularism is only when you truly believe everyone is equal and ensure that everyone thinks that way.
Do you think I took freedom of expression too far?
Freedom of Expression - Here's my post that is directly against this one and says you should not say whatever you want to and exercise restraint.

Think I am a bigoted idiot?
Read this story - In my opinion, everyone can easily live together happily if everyone minds their own business. Here's a very inspiring story - A true story about how unity in diversity

Comments from Facebook

Ashok Tripathi:
Hmm.. You will get more brickbats then bouquets for this..

Raveesh Mayya:
Good post Baliga.. I too feel disgusted to think that saying "I'm a Hindu" has been equated to saying "I'm communal"..

Nikhil Baliga:
That's precisely my grouse. Somehow I am made to feel like it is wrong to be Hindu. And I am screwed if I am a Hindu Brahmin boy

Ashok Tripathi:
Screwed royally Hindu Brhamin Boy - you are ancestors are single handedly responsible for all the catastrophes in planet s history from extinction of Dinos to ************************** 

Prashanth Raghu:
Although I do not agree with all the points, I like the fact that you say what's in your mind. Not many people do that. Amazing frank free flow of thoughts.

Prashanth Harshangi:
Baliga- do you like the concept in school where every student had to wear uniform?

Soujanya S Purohit:
Good one!!

Sharath AS:
Just when you were giving an example of Dalit girl being raped!

Manohar Kanyady:
People or Govt need to be really matured to act upon it to solve the so called communal tag

Gurudatha Pai: 
Dawkins asks a similar question in some interview about "The God Delusion"!

Dolly Singh:
Nice post nik.. In my opinion there s nothing bad in speaking loud your thoughts. And no one should judge. But it is something like you are calling a blind person blind. It might be offending to them. So if any bitter truth is not helping any one then better to avoid speaking it.

Karan Sharma:
Nikhil Baliga: fair post man. Just a couple of points. 
1) Sorry to hear that you have friends who listen to Zakir Naik. In spite of the moron he is, he serves a very important role. He is the sole Muslim rationalist preacher (if such a thing exists) who doesnt want to kill/murder rest of the world..
2) You mentioned profiling. I'm with you on the fact that nothing wrong in calling a spade a spade. Because thats what it is. The problem lies with what you do with that profiling and the connotations that go with religious and racial profiling. You cannot deny the historical baggage that we all carry.. Whites are sorry they f*cked browns and blacks. Hindus are sorry they f*cked Muslims(and other minorities). Men are sorry they f*cked (not literaly) women historically. Brahmins are sorry they f*cked dalits. 
So basically we live in a world of apologists and not being one lands you in trouble.

Karthik Rangarajan:
"Free speech is not speech you agree with, uttered by someone you admire. It's speech that you find stupid, selfish, dangerous, uninformed or threatening, spoken and sponsored by someone you despise, fear or ridicule. Free speech is unpopular, contentious and sometimes ugly. It reflects a tolerance for differences. If everyone agreed on all things, we wouldn't need it."

(Source here)

First of all, very well written article, my friend. When I looked at the title, I knew it would be an interesting take on things. I expected some hyperbole, and a few flawed arguments. I'm happy that there was very little hyperbole, and almost no flaws in your method of arguing.

So if we are allowed to openly dislike people, hate people and openly call them names, why are we not allowed to, for example, dislike an entire community?

There is a pretty big difference between you or me disliking people/community, and people in power doing so. However, I see your argument, and I agree with the point you're making. As long as your dislike is personal, doesn't affect a third-party negatively, and you do not force others to think your way, you are entitled to have your views.

What? Why can't I say Chinese out loud? My friend even deleted a comment of mine that said something about Chinese because a Chinese guy was in his thread.

This is hyper sensitiveness and bullshittery. I call my Chinese friends Chinese to their face. I call my black friends black, or in more professional settings, African Americans. I call friends from the south hillbillies. As long as there is no malice in what you're saying, and you're saying it with the best of intentions, it really doesn't matter. However, do note that "blackies", "chinkies", etc. are derogatory terms.

If you call an IITian or a person from an IIM incompetent, it feels like a great sin has been committed.

More bullshittery.

Would you call me a bigot for not talking to a gay person or not wanting my son to be gay?

Yes for the first one, no for the second. You are, at the end of the day, making the person feel unwelcome or unwanted. Bigotry has nothing to do with power. You're judging a person because he is different from you, and that, my friend, is the very definition of bigotry.

But why do I saw no for the second one? Because not wanting your son to be gay is perfectly natural. You want your son to meet the expectations you have of him. Now, if you force him to be gay by sending him to a "correctional" school, then you're not just bigoted, but you're cruel and insensitive.

If a strictly vegetarian Brahmin family doesn't want to rent out a house to a non-vegetarian Muslim family, is this discrimination against Muslims or discrimination against non-vegetarians? If this family gave the house out for rent to a non-vegetarian Hindu family, then should the Muslims say that they were discriminated against? If the family gives the house for rent to a vegetarian Hindu family, can the non-vegetarian Hindu family say they were discriminated against? 

Since this is their house, they are free to rent it out to whoever they feel can best maintain their house. The argument for discrimination doesn't even come in here. Unlike in the US, private housing in India does not have to follow equal opportunity laws. (although I am unsure if this is the case in the US either)

Here's one qualm I have with the methodology of argument - you're saying since you have the freedom of expression, you're allowed to state them. However, if your only defense to stating your arguments IS your freedom of expression, then you're argument is on its last crutches. (I do see that you aren't saying that - just a minor comment)

I want to call India a Hindu country where every other religion is welcome to stay and live with us. Hindus are very tolerant and India will remain a secular Hindu state with no discrimination against any community. Remember, this kind of diversity is possible in India because of tolerance of Hindus.

This argument I have many problems with. It might be another part of your thought experiment, but a country cannot be identified by a religion. I have a problem with US Government identifying the country as a Christian state, the Indian government identifying it as a Hindu state, etc. There must always be a separation of religion and state. It is vital for a government to function rationally.

Why do I believe so strongly about this?

You're asking people to think rationally about one thing there is very little rationality about: religion (and/or race). Arguments about these are always going to be heated, mindless, and overdrawn because people believe so passionately that what they think must be the absolute truth. I appreciate your thought experiment and attempts to bring rationality as well as have an open conversation - but religion is not at all rational. Not when we're saying age old texts translated uncounted number of times should be made into laws, that our women must be judged according to it, etc.

But Freedom of Expression! I can say whatever I want!

You can, sure. My government cannot. They absolutely cannot say "we tolerate other religions here because we're Hindus, and we're tolerant." That's giving a pedestal to one religion, and saying the other religions exist in the state because we're so nice and tolerant, and not because they have equal right to stay there since they're citizens with the same, exact rights.

On the other hand, I do agree about the uniform civil code. Secularism isn't about treating one religion better than another, apologizing for what our ancestors might have done oppressing other castes and/or religions, or handling everything with baby gloves. Its about treating all people equally, like they are all citizens of the country, without discrimination, with the same, exact laws. THAT is what is being called as communalism now by the left-leaning parties, and that is utter bullshit. It is high time the country developed a uniform civil code, with merit based reservations versus caste based ones.

Sorry, this was almost as long as a blog post. I rarely participate in these debates for this very reason - most people don't have the patience to read what I have to say, or get bored half way through. :)

Well written article, all the way around. You've done a great job at being unbiased in spite of your strong beliefs in a certain direction.

Sunday, 27 April 2014

Writing games in JavaScript

Swami Nikhilaananda said:
"All work and no play makes Gulagulaananda a dull old man... well duller"

With every passing day, I am beginning to like JavaScript more and more. JavaScript is very easy to learn and with one language, you can write front-end applications, back-end scripts, run servers and even write mobile apps for Android, iOS, Tizen etc. I think that's incredible!

I have written a couple of simple games with JavaScript and thought I should write a post about one of them. So, let's have a look at a simple game I wrote, called Crates.

The objective of the game is simple. There is a "hero", a character you control with the keyboard arrows. There are some crates and some targets (golden balls). The goal is to cover all targets with the crates. The hero can push a single crate but never pull one. Only one crate can be pushed at a time. A crate that is against the wall or another crate cannot be pushed. So it gets tricky when you push crates to some corner.

The game is a clone of the classic 'Box World' that I had played long ago in school. I just wrote this one in JS as an exercise. Let's dissect and see how it was written. I would really appreciate it if you can leave some suggestions at the end.

You can play the game here and find  the source on Github here. (This game isn't really well written, it was written in a great hurry. But the concepts in this post are sound, and I would like you to look at it, rather than the source code of crates. I would recommend looking at the source code of MemBlock instead.)

Everything is a matrix
One of the main reasons I loved Matlab in college was that everything was a matrix. It was like some deep philosophical thing - everything is Brahman. An image can be represented as a matrix, with each point being a number in the matrix and the value being the intensity. RGB frames in colour images are three matrices, all within one matrix. Sound can be represented as a matrix. Basically, everything is a matrix.

Keeping that in mind, I like to see games as matrices. If a particular cell has 0, it translates to a wall. If a cell has 1, it translates to grass. If it is 4, it translates to the hero, and so on. So a simple matrix like this represents a hero standing with grass on one side and a wall on the other:
[0, 4, 1]

Next, we have to use some syntactic sugar. What this means is that, we don't want to use numbers like 0, 1 etc. in our code to make comparisons. While you might understand this while writing code, you will never understand it a month later. Imagine seeing this piece of code:
if (matrix[i][j] == 3)

What's 3? Therefore, let's define variables like:
var WALL = 0;
So that we can make comparisons like:
if (matrix[i][j] == WALL)
you will know what you are doing.

Models and Views?
Once we have defined what each number in a matrix means, we have to write a very important function - a rendering function. This function essentially translates changes in the matrix to changes on screen. What does this mean? This is exactly along the lines of MVC, where the matrix is your model, and the graphics you see on the screen is the view. Changing the matrix behind the scenes changes the model, but someone has to change the view. So you have two options here - Either use some kind of an MVC framework that does this automatically for you, such as AngularJS, etc. (which in my opinion, is an overkill for simple games) or write your own rendering function.

Personally, I write my own simple functions for rendering - I call it draw_map(). The draw_map function simply reads the matrix and draws the map, period. In this function, you can represent the numbers by some graphics. Keep all your images in some folder called assets.

Let's move (on)
Next, we need to be able to read input from the user - Just bind keypress or keydown event to the document or window, check if the input key is one among the ones that you want. Otherwise, simply discard it. Again, use some syntactic sugar for key codes.
var LEFT_ARROW = 37;
var RIGHT_ARROW = 39;
var UP_ARROW = 38;
var DOWN_ARROW = 40;
The fact that JavaScript is an event based language makes it great for games!
Then comes the important part of the game - The logic. Depending on the key code, check if the move is valid by validating it against the matrix. If it is valid, change the matrix and call the draw map function. If it is not valid, either reject it, or indicate it to the user with a subtle 'invalid move'. Always remember that all changes should be made only to the matrix and no DOM changes should be made whatsoever. So, if you want to increase or decrease points, do it by altering the variable. But the actual display of the score on screen should be done by the rendering function.

What next?
That's it! You are done with the game. However, games such as these are only as fun as the number of levels in it. You can build only as many levels. To take it to the next level, would be to create a simple game world creator so that your users can design levels and share it with others. The game designer uses the same rendering function, and with some small alterations, a lot of code can be reused. Ensure that the user can play and test out the games she has created. Once that is done, and the game gets validated, enable upload and sharing of the game. Check out Crate's "Create a world" section. It allows you to create worlds and test it, but the publish feature as of now is not linked to any backend servers for persistence. It instead simply spits out a matrix when you "Return to game design" that you can mail to me.

Can this be improved further?
The answer, according to me, is a resounding yes. A lot of games can be made using this matrix concept, and there are a lot of similarities among these games. The ability to create worlds, uploading and reading games created by others can be the same across games. So, it should be possible to create some kind of a game framework around this. If anyone is interested in building this with me, please let me know.

Many games such as pacman, NumArrange (uses AngularJS), MemBlock use matrices. Think of other games that can be built using matrices

The other way of building a game would be using classes and objects. Perhaps there will be another post about that.

Recommended Posts
I would like to highly recommend by friend Niyaz's post on how to write a chess game in JavaScript - I think he uses the same method.