Enter the maze

The Prisoner's Dilemma

Headmaster reprimanding student

Should you snitch on a friend, and why are computer scientists interested in whether you do? Sam Tazzyman, a student at UCL, explains.

You've been caught with your best friend breaking the rules. The Head's not sure how it happened though. You are in one room with the Headteacher, and your friend is in another with the Deputy head. You've got no way of talking to each other. The Head gives you a choice: you can either tell on your friend or you can stay quiet. If you grass, you won't be punished as harshly. The twist is that the deputy head is in the other room giving your friend exactly the same options.

The punishments you get depending on how you and your friend answer are as follows:

punishment table

What would you answer the Head? Imagine that you think your friend will not snitch. Then if you don't tell either you both get only half a lunchtime of detention. But if you do tell on them you personally get away with no punishment at all! What about if you are sure that your friend will land you in it? Then if you don't tell on your friend you get 10 lunchtimes of detention! But if you tell on your friend then you only get 2 lunchtimes of detention. So no matter what your friend does, you're better off telling on them. But if your friend also realises that, you'll both get 2 lunchtimes detention. If you could have just agreed not to snitch on each other at all you'd both only have done half a lunchtime detention.

This scenario is called "The Prisoner's Dilemma", and is a famous example of a branch of mathematics called "Game Theory". In Game Theory, mathematicians and computer scientists use games like this to try to understand why people act in the way that they do. In the case of the Prisoner's Dilemma, it makes a big difference to the game if it is a one-off situation, or if it the same players repeat the game over and over again.

Hands on Bars

In the first case, you are better off telling on your friend, as above. But what about in the second case? To try and answer this question, competitions were set up in the 1980s where lots of computer scientists and mathematicians from around the world wrote computer programs to play the prisoner's dilemma against each other in tournaments. Each program was programmed to follow a different strategy, some quite complicated. In these tournaments, snitching was called "defecting", and not snitching was called "cooperating". So what was the the best thing to do?

Amazingly the winning strategy was the simplest. Whenever the winning program played against a new opponent, it would start by cooperating. From then on, it would simply do what the opponent did on the go before. If you think about this, it's a bit like real life. When you meet someone new, you generally start out by being nice to them. If they are nice back you continue to be nice. If they are nasty to you, you will probably be nasty back until they start being nice again, at which point you'll probably forgive them and be nice once more. So the way most people act is also the best way to win at this game. Of course, in real life, a better way would be not getting in to trouble with the teacher in the first place!

Russell Crowe played Game Theorist John Nash in the Oscar winning film "A Beautiful Mind".

So why are scientists interested in the Prisoner's Dilemma? Well, the maths behind it can have applications in lots of areas of life, not just prisoners trying to get less time in jail. An example of this is an arms race between two countries. Nobody wants the countries to have bigger and better guns and bombs because that means if they have a war more people will die (and it's expensive). So both countries have an agreement not to build bigger and better weapons. Now imagine you are the leader of one of the countries: you can choose to spend money and time on making bigger and better guns ("defect" from the agreement) or you can choose not to ("cooperate" with the agreement). This is mathematically the same as the Prisoner's Dilemma: If you cooperate with the treaty, and the other country doesn't, and there is a war, they will be better equipped and you will lose. So if you think they are going to defect, you should defect. However, if you defect and they cooperate you will win if there is a war. So even if you think they are going to cooperate you should still defect. Of course, the other country's leader will also be able to work that out, so the result is that you will probably both defect. Therefore both countries end up in an arms race, trying to build bigger and better weapons: exactly the result neither side wanted in the first place.

There are lots of other applications of the Prisoner's Dilemma, across a wide variety of subjects, including sociology, political science, ecology, evolutionary biology, economics, business science, and philosophy. There are also a whole bunch of other, different Game Theory games, each exploring the essence of how agents (people, computers, animals,...) making decisions interact. Not suprisingly computer scientists are interested in it for its applications in, amongst other things, Artificial Intelligence.

So remember, even if it's just a game to you, Scientists may be using it to help with life and death decisions!