Contest 2: Repeated Prisoner Dilemma (due October-5, 11:59pm)
Table of Contents
Confess?
Stay Silent?
Maximiaze utility!
Overview
In this contest, you will implement an agent for playing the
repeated prisoner dilemma game. This game has a twist in the form
of uncertainty regarding the reported opponent action from the
previous round. The contest code is available as a zip
archive (contest2.zip
).
There is room to bring your own unique ideas, and there is no single set solution. Much looking forward to seeing what you come up with!
Quick Start Guide
- Download the code (
contest2.zip
), unzip it, and change to the directory. - Go into
Players/MyPlayer.py
and fill out your UINs separated by ‘:’ (not by ‘,’) in the “UIN” field, choose a team name at “your team name”, Write your strategy under the “play” function. Your strategy should take into account the opponent’s previous action and level of uncertainty regarding the previous action report. - Run
python Game.py
, for each pair of players in the Players folder, 1000 rounds will be played on expectation (there is a 0.001e^(-0.001) chance of terminating on every round). - Submit the
MyPlayer.py
file to Contest 2 on Canvas.
Grading
Grading is assigned according to the following key:
- • +1 points per staff bot (tough guy, nice guy, tit for tat) beaten in the final ranking
- • +0.1 points per student bot beaten in the final ranking
- 1st place: +2 points
- 2nd and 3rd place: +1.5 points
Introduction
You are required to design an agent that plays the prisoner dilemma repeatedly against the same opponent. Your agent should attempt to maximize its utility where. As we saw in class, the Nash equilibrium for this game results in low utility for both players. You should attempt to coordinate a better outcome over repeated rounds.
External libraries: in this contest, you are allowed to use numpy as a dependency.
Files you'll edit: | |
MyPlayer.py |
Contains all of the code needed for defining your agent. |
Files you might want to look at: | |
Player.py |
The abstract class for player (your player must inherit from this class). |
Game.py |
The tournament execution. |
Files to Edit and Submit: You will fill and submit MyPlayer.py
.
Academic Dishonesty: We will be checking your code against other submissions in the class for logical redundancy. If you copy someone else's code and submit it with minor changes, we will know. These cheat detectors are quite hard to fool, so please don't try. We trust you all to submit your own work only; please don't let us down. If you do, we will pursue the strongest consequences available to us.
Getting Help: You are not alone! If you find yourself stuck on something, contact the course staff for help. Office hours, section, and the discussion forum are there for your support; please use them. If you can't make our office hours, let us know and we will schedule more. We want these contests to be rewarding and instructional, not frustrating and demoralizing. But, we don't know when or how to help unless you ask.
Discussion: Please be careful not to post spoilers.
Rules
Layout
Once you run Game.py, a tournament will take place during which every pair of players, defined in the Players directory, will face each other. Each match will consist of 1000 rounds in expectancy.
Scoring
For each round in a single match you will receive -1 (i.e., 1 year in jail) points if you confess while your opponent is silent, -4 if you both confess, -5 if you are silent while your opponent confesses, and -2 if you both keep silent. Your average score from a single match will be summed over all matches to determine your overall ranking. Your final score will be determined based on your overall rank. Based to the grading policy provided above.
Designing Agents
File Format
You should include your agents in a file of the same format as MyPlayer.py
. Your agents must be completely contained in this one file.
Agent
Your agent should attempt to exploit naïve opponents, not being exploited by aggressive opponent, and encourage opponent cooperation when appropriate. The best strategy depends on the strategy implemented by your opponent. Try to design an agent that can adapt to different opponents. Remember that your goal is not to win single matches but to gain the maximal score over all matches. That is, even if you are able to outperform the staff bots in a single match, you might still get an overall score that is lower because the overall scores are summed over all matches.
Getting Started
Implement a simple agent. For instance, one that always returns
“confess”. Now run Game.py
. A tournament will run matching your
player with all three staff bots. The tournament outcome (final
scores) will be written to results.csv
. You should now attempt to
improve your agent’s strategy to the best of your understanding.