The Prisoner's Dilemma

Introduction

Learn It

  • Game theory is the study of how and why people make decisions.
  • It is used extensively in the study of economics, and can often show surprising insights into how people behave.
  • We'll look at some of these in this unit, and code some different games along the way in both Scratch and Python.

Try It

  • The Prisoner's Dilemma is probably the most popular example of game theory in action. It demonstrates that people don't always act in their own best interests.
  • Imagine that two people have been arrested for a crime, and the police are uncertain which person committed the crime and which person helped carry it out.
  • Each prisoner is put into a different room and given a choice:
    • Remain silent
    • Betray your parter
  • If both stay silent, they will both be sent to prison for 1 year.
  • If they both betray one another, they can both be sent away for 3 years.
  • If one betrays the other, the betrayer goes free, and the other is imprisoned for 5 years.
  • The lowest total amount of prison time somes from both parties cooperating, but there's always the risk that the other person might not be as kind of you.
  • This becomes more interesting if we play the game once, then immediately play it again. Each player will now have a knowledge of how the other person behaved last time, and this will influence their decision making process.
  • If we assign points (based on minimizing time in jail), we can develop different game strategies to minimize the time the human player stays in jail over multiple games.

Learn It

  • The same idea can be seen in different places in human society.
  • Imagine a pair of competing fizzy drinks manufacturers. They both have two options when considering the sales of their products:
    • Option 1: Don't spend money on advertising. People know your product already, and are currently buying it at a steady rate.
    • Option 2: Spend money on advertising. It'll cost money, but sales will increase.
  • If both companies cooperate (option 1), they'll both enjoy steady profits and won't have to spend thousands of pounds on advertising.
  • If one advertises and the other doesn't, one company will see their sales increase as the other company's sales (and profits) drop.
  • If both companies advertise, the effects of them both advertising will cancel each other out, and both companies will see their overall profits drop because of the money they're spending on advertising.
  • In real life, competing companies tend to advertise aggressively.

Code It

  • In a new browser tab, open this link to see a prisoner's dilemma simulator
  • If you've a Scratch account, you can sign in to save the work you'll do here.
  • If you've not got one, you can always click 'File -> Download to your computer' when you're finished to ensure your work is saved.
  • Unfortunately, it looks like the developer didn't have time to finish the code, and there are some blanks.
  • Based on the rules set out above, can you complete the code and make the game work?

Badge It

  • The badge tasks for this week's tasks will be uploaded next lesson.