Iterated Prisoner's Dilemma

CSEF · 2019 Mathematical Sciences

Overview

Objectives The objective of my project is to compare several different strategies used in the game Iterated Prisoner s Dilemma. I investigate how each strategy performs against all other available strategies, and which strategies are most/least successful overall. Methods For this experiment, I wrote a program in Python that implemented 11 different Iterated Prisoner s Dilemma strategies, and had them compete against each other in a round-robin tournament. In each matchup, a pair of strategies played against each other for 200 iterations. For each iteration, the following scoring system was used: (a) if both strategies cooperate, they receive 3 points each; (b) if both strategies defect, they receive 1 point each; (c) if one strategy cooperates and the other defects, they receive scores of 0 and 5 points, respectively. Each strategy competed against every other available strategy, including itself, for a total of 121 matchups. The entire tournament was run a total of 10 times, to account for the random factors present in some of the strategies. Scores per iteration were averaged across all tournaments. The strategies used were: Always Cooperate (AC), Always Defect (AD), Tit for Tat (TFT), Massive Retaliatory Strike (MRS), Random (R), Soft Majority (SM), Firm but Fair (FBF), Naïve Prober (NP), Tit for Two Tats (TFTT), Two Tits for Tat (TTFT), and Pavlov (PV). Results From most to least successful, the strategies were: SM (average 2.68 points per iteration), TFTT (2.66 pts), MRS (2.64 pts), FBF (2.62 pts), TTFT (2.61 pts), PV (2.61 pts), TFT (2.59 pts), AC (2.56 pts), R (2.17 pts), NP (1.94 pts), and AD (1.92 pts). Conclusions By using only 11 strategies in my experiment, I was able to analyze each strategy s performance carefully, and understand why certain strategies outperformed others. My hypothesis, based on background research, was that the best strategy would be TFT. However, SM outperformed TFT, mainly because SM did better against NP than TFT. Similarly, I predicted that the worst strategy would be AC, but because many of the strategies used in this experiment rewarded cooperation and punished constant defecting, AD ended up losing instead of AC. It s important to note that my results were specific to these particular strategies. Every strategy used impacts the performance of every other strategy. Therefore, if different or additional strategies were used, the final results would be different.

Summary statement

I implemented an Iterated Prisoner s Dilemma tournament in Python and analyzed the performance of 11 different strategies that competed against each other.

Help received

My mom taught me about classes and objects in Python. My dad taught me about standard deviation and standard error.

Competition history

  • CSEF 2019 Mathematical Sciences · Entry J1408

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google