CSCI 151 Lab 2: Prisoner's Dilemma


Overview

In this lab, we will develop computational strategies for the Iterated Prisoner's Dilemma.

Materials

Setup

Eclipse

You should already have Eclipse set up from class. If you are having any trouble, ask Dr. Yorgey or your TA (Ryan Rose).

Project

  1. Download the skeleton for this project.
  2. Extract the file to your desired location.
  3. Open Eclipse.
  4. Select File > New > Java Project

  5. When the "Create a Java Project" dialog opens up, de-select "Use default location".
  6. Then click "Browse". Navigate to the location of your extracted archive.

  7. Click "Finish" to create the project.

  8. Go to the Package Explorer, and make sure the desired files are in place.

Description

The Prisoner's Dilemma is a classic example in Economic Game Theory. Two burglars are taken in by police. They are simultaneously interrogated in separate rooms. Each burglar must decide whether to COOPERATE with each other to stay quiet, or DEFECT and talk to the police.

It is temping to try and DEFECT when the other player COOPERATEs, but they will have the same idea, and the rational end result is that both DEFECT. So much for cooperation.

However, if we put the burglars in this situation repeatedly, without knowing when the process will end, a different outcome is possible. This is known as the Iterated Prisoner's Dilemma. Now, burglars can start to formulate strategies of how to play based on the history of interactions with the other player.

In this lab, you will be coding up different strategies for players. We will assign points for the different outcomes as follows, with higher points being better for the players. (negative points imply time in prison)

Making Strategies

To create a strategy, create a class that implements the Strategy interface, and place it in the strategies package. Three simple examples have been provided.

Your grade will depend upon the total number of strategies you create, subject to the following constraints:

To run a simulation with your strategies, execute the Simulator class.

What to Hand In

Submit all of your strategy files (the .java files you wrote) via Moodle by Tuesday, September 13 at 5pm.

We will run a simulation competition during class the next morning.

Grading


© Mark Goadrich, Hendrix College