Welcome to my blog, hope you enjoy reading :)

Sunday, February 24, 2013

Game Theory for Crafting your Movie Scripts

One problem as a director or script writer you would face is to figure out if the ending of your movie that you have proposed will be liked by the audience. How will you figure it out?
Have you heard about the Prisoner's Dilemma? I recently got interested in exploring Game Theory though I have heard about it nearly a decade ago. I have already come across three central themes that are very different at the concept level but as you break them down they are non other than Prisoner's Dilemma in disguise! What is nice about Game Theory is that it offers a way to visualize the results/outcome/payoffs and determine if it will be something that the players would do and if indeed the players chose certain actions then will the onlookers like the result? Yes there is a branch that explores how the observers would react keeping the players aside! Interesting isn't it? Go explore more.
Anyway as I started to learn more I started to think why I hated the endings of some of the great movies of the past - like Butch Cassidy and theSundance Kid though this might have been based on real life incidents),Topkapi(1964), The Great Escape (1963), Italian Job and the like. These are great movies but I hate the endings and I couldn't figure out why. But after learning a little of Game Theory I am inclined to think that movies are like games and the endings are payoffs for various outcomes.When your expectations do no match with the outcome the director has presented then you don't like the ending.
On the flip side you can construct the central theme of your script as a game, explain the options and layout the payoffs - then let the players explore the options and figure out the best if I were to do that I would not end the movie with the option that is bad for both the protagonist and the antagonist!
Check out the Sheriff's dilemma which is nothing but the Mexican Standoff! But the thoughts and analysis would  send you thinking on the kinds of concepts one can imagine for their movies.
Let me know if you have successfully employed Game Theory to craft your movies. Was it successful?

On a philosophical note, life itself can be modeled as a Bayesian Game or a variant of Coalitional and Bayesian Games! And, again I think, as game players with an objective to score more points you have to play your best possible actions as often as possible to be continuously scoring! Have you been doing that with your life? 

And here is a list of movies that use game theory!!

Wednesday, February 20, 2013

MediaPlayer in JavaFx and Processing

Here is a nice article on writing your own media player using Java and JavaFX.

That was from
You can find the code at:
I had been struggling to get started with JavaFX but somehow I could feel the entry barrier because of the slightly different syntax of JavaFX. However this sample does not look so bad!

Just a few days ago I also learnt that there was something called Processing ( which is popular among artists! And seems like folks use to write media players and what not with processing... so I was curious to see if this was equally powerful or was easier than JavaFX. So I went Google... Google... and found this:
So now it seemed like processing is quite good! Check out the source at has some nice articles on Mobile programming too:

BlueTooth and BlueCove - JSR 82

A while ago I had dabbled with ZigBee and wrote a sample to show how a thermostat can communicate via ZigBee to a PC which can graphically show the temperature; the idea was to develop a remote interface using which the homeowner can control various aspects(like security, thermostat, lights etc) all controlled and communication over ZigBee. But somewhere along the idea crumbled to a horrible death :) and I lost  the contact who was providing me with the ZigBee controllers and APIs etc.

Few years fast forward and still I find that there are opportunities and possibilities to develop interesting utilities using wireless technologies. BlueTooth is very promising  Here is an implementation on JSR 82 in Java - it is called BlueCove (

The latest implementation is available here:

I just played with the samples and they worked fine...check it out... I have something in mind and once I am through I will share more...