Programming Competition Prisoners Dilemma

1 minute read

I have been trying to think of a simple programming competition that we can run at the next SHHH (Super Happy Hacker House) at the Vancouver Hackspace.

ACM International Collegiate Programming Contest seems like an obvious choice. I have run though these contest back in collage and they where very challenging.

Too challenging for a SHHH where would probably consuming some beers and having fun. I was hoping for one with less of a barrier to entry where people with less programming experience could at-lest join in.

A few months ago I listened to a Radio Lab podcast on the prisoners-dilemma where they describe the problem and created a competition where people could submit robots that would play this game. They went on to describe the outcome of a few of these robots, how they worked, why they worked that way. It was a interesting podcast.

This sounded perfect for a simple programming contest. It only had a few rules, inputs,  outputs and its very simple to teach someone. So I created a model of the system with a few example bots.

  • Jebus - Always cooperates.
  • Snitch - Always defects.
  • Random - Randomly makes choices.
  • Copy Cat - Starts by cooperating but then copies his opponents last move.
  • Fool Me Once - Starts by cooperating but if opponents ever defect it will defect every time after that.
  • Forgives - Starts by cooperating, if the opponents defect it will defect until the opponents cooperates twice in a row.

As you can see from the results the Snitch wins most of the single rounds since he starts by defecting first and gets a jump start on the rest of the group. But overall the Snitch does do well but not the best as he can never cooperate with anyone to reduce his sentence. The fool me once bot tends to do better as he can recover from the snitch the easiest.

Source code can be found on github funvill/PrisonersDilemma

This was an interesting exercise and it was fun to program but its too simple for a programming competition. The problem is that there is only one input, output and does not allow for a variety of choices.

Other research 

On stack overflow I found a programming competition for creating the best battleship AI. I also found this one produced by Google that looks amazing http://aichallenge.org/ too bad there servers are down

More research is needed.

 

 

Leave a comment