Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com), Millisecond
Created: January 13, 2017
Last Modified: January 29, 2023 by K. Borchert (katjab@millisecond.com), Millisecond
Script Copyright © Millisecond Software, LLC
This script implements a computer version of the Prisoner's Dilemma Task; a decision making task about cooperation and competition in resource allocation in the absence of knowing what the other party's decision will be. The Prisoner's Dilemma Task is a non-zero-sum game where the rewards are not a straightforward 'I win what you lose (or vice versa)' but rather a more varied pattern of resource allocation depending on the cooperative vs. competitive choices of both parties. The dilemma is to decide between cooperation and competition (aka self-interest) when competition might yield the highest (immediate) reward but loses to cooperation if both parties decide to compete.
The implemented procedur is based on a generic matrix presentation procedure described by:
Lyn Ellett , Rhani Allen-Crooks , Adele Stevens , Tim Wildschut & Paul Chadwick (2013) A paradigm for the study of paranoia in the general population: The Prisoner's Dilemma Game, Cognition and Emotion, 27:1, 53-62, DOI: 10.1080/02699931.2012.689757
5 minutes
Participants play a 'game' for points with a co-player (computer). An outcome matrix is presented that outlines the gains in points if participant and co-player choose cooperative (simply labeled as "strategy X") or competitive (simply labeled "strategy Y") strategies.
All numbers in the outcome matrix follow the general pattern (= Prisoner's Dilemma Game Matrix or short: PDG Matrix):
Cooperation loss (participant cooperates, computer competes) < Competitive loss (participant AND computer compete) < Cooperation win (participant AND computer cooperate) < Competitive win (participant competes, computer cooperates)
Participant has to make a decision without knowing which strategy the co-player will choose. Number of games played as well as strategy selection of computer can be set by experimenter. By default, only one game is played (to change, go to section Editable Parameters). Default instructions are used that imply that 'up to 6 games' may be played. These instructions can also easily be edited (to change, go to section Editable Parameters).
In this script, following the procedure described by Ellett et al (2013), no contextual game story is provided along with the PDG matrix nor are explicit instructions such as "maximize your gains" given. The words 'cooperative' vs. 'competitive' are NOT mentioned to participant. This, however, can all be edited by changing the provided instruction html-files.
1. Instructions
The instruction blocks gives general information about the task and walks participants through
the PDG outcome matrix.
2. Practice
The practice blocks practices and tests participant's understanding of the value matrix.
( In this script, values used during practice can either follow the PDG pattern (default) or can be
assigned randomly. See section Editable Parameters)
Each practice blocks presents 4 trials that pose a question regarding each of the 4 matrix quadrants:
"If you select strategy: A and your co-player selects strategy: B
How many points will {you/co-player} get?"
Participants have to get all four questions of a practice block correct before moving on to the test block.
Practice is repeated until all 4 questions are answered correctly or 10 practice blocks have run.
After 10 practice blocks the script aborts if participant does not provide perfect understanding of the matrix set-up.
3. Test
The test runs as many games as specified by parameters.numberOfGames (default: 1, see Ellett et al, 2013)
Participant are told they are paired with a co-player. By default, the 'pairing' takes 5s (editable parameter).
For each round a new PDG matrix is presented and participants have to make a choice.
After they make their choice, a random delay is introduced that simulates the decision time of the coplayer
(sometimes the co-player takes more time, sometimes less).
Once both decisions are 'known', feedback is provided and the participant is told what strategy the co-player chose,
and how many points they both won. The feedback also includes an update of the total number of points won across all games played.
PDG Matrix Values:
This script implements three patterns to calculate the values presented in the PDG matrices. By default, the pattern is
selected randomly without replacement by list.patterns (see section Editable Lists)
pattern 1 =>
COOPERATION LOSS = COOP - 2* 1/3COOP
COMPETITION LOSS = COOP - 1* 1/3COOP
COOPERATION WIN = COOP
COMPETITION WIN = COOP + 1* 1/3COOP
pattern2 =>
COOPERATION LOSS = COOP - 2* 1/2COOP = 0
COMPETITION LOSS = COOP - 1* 1/2COOP
COOPERATION WIN = COOP
COMPETITION WIN = COOP + 1* 1/2COOP
pattern3 =>
COOPERATION LOSS = COOP - 3.5* 1/4COOP
COMPETITION LOSS = COOP - 3* 1/4COOP
COOPERATION WIN = COOP
COMPETITION WIN = COOP + 3* 1/4COOP
The cooperation win number (COOP) is randomly selected by list.cooperativeWinNumber (see section Editable List).
By default, numbers from 1-100 are selected randomly without replacement.
provided by Millisecond - can be edited under section Editable Stimuli
Instructions are not original to the task. They are provided by Millisecond
as htm/html pages can be edited either by changing the provided htm/html files.
To edit htm/html-files: open the respective documents in simple Text Editors such as TextEdit (Mac)
or Notepad (Windows).
File Name: prisonerdilemma_pdgmatrix_summary*.iqdat
| Name | Description |
|---|---|
| inquisit.version | Inquisit version number |
| computer.platform | Device platform: win | mac |ios | android |
| startDate | Date the session was run |
| startTime | Time the session was run |
| subjectId | Participant ID |
| groupId | Group number |
| sessionId | Session number |
| elapsedTime | Session duration in ms |
| completed | 0 = Test was not completed 1 = Test was completed |
| computerStrategy | The strategy the computer uses to make its choice (determined by experimenter) 1 = 'cooperation': selects the cooperative strategy X on every round 2 = 'competition': simply defects on every round of every game by choosing the non-cooperative strategy Y 3 = 'random': selects randomly 4 = 'tit-for-tat': cooperates on first round then mirrors the players choices from the previous rounds 5 = 'tit-for-two-tats': computer cooperates until 2 defects in a row and does not cooperate again until player does 6 = 'probabilistic': cooperates on first round, then selects the strategy that is most often used by player ( if player has selected the cooperative strategy exactly 50% of the time, computer selects cooperative strategy) |
| countPracticeBlocks | Number of practice blocks run |
| list.practiceAcc.mean | Proportion correct during the last practice block |
| countRounds | The number of games played |
| totalPlayer | Stores the total points won by participant |
| totalCoplayer | Stores the total points won by computer |
| numberCoOperation | Absolute number of selecting cooperation strategy (X) |
| propCoOperation | Proportion of cooperation strategy (X) selections |
| numberCompetition | Absolute number of selecting competition strategy (Y) |
| propCompetition | Proportion of competition strategy (Y) selections |
| meanRT | Mean overall response time (in ms) |
| meanRTCoOperation | Mean response time (in ms) of selecting cooperation strategy (X) |
| meanRTCompetition | Mean response time (in ms) of selecting cooperation strategy (Y) |
| countResponsesAfterCompetition | Number of responses made after the computer previously chose competition |
| propCoOperationAfterCompetition | Proporation cooperation after the computer previously chose competition |
| numberCoOperationAfterCompetition | Absolute number of cooperations after the computer previously chose competition |
| meanRTAfterCompetition | Mean response time (in ms) after the computer previously chose competition |
| meanRTCoOperationAfterCompetition | Mean response time (in ms) of cooperative responses after the computer previously chose competition |
| meanRTCompetitionAfterCompetition | Mean response time (in ms) of competitive responses after the computer previously chose competition |
| countResponsesAfterCoOperation | Number of responses made after the computer previously chose cooperation |
| propCoOperationAfterCoOperation | Proporation cooperation after the computer previously chose cooperation |
| numberCoOperationAfterCoOperation | Absolute number of cooperations after the computer previously chose cooperation |
| meanRTAfterCoOperation | Mean response time (in ms) after the computer previously chose cooperation |
| meanRTCoOperationAfterCoOperation | Mean response time (in ms) of cooperative responses after the computer previously chose cooperation |
| meanRTCompetitionAfterCoOperation | Mean response time (in ms) of competitive responses after the computer previously chose cooperation |
File Name: prisonerdilemma_pdgmatrix_raw*.iqdat
| Name | Description |
|---|---|
| build | Inquisit version number |
| computer.platform | Device platform: win | mac |ios | android |
| date | Date the session was run |
| time | Time the session was run |
| subject, group, | With the current subject/groupnumber |
| session | Session number |
| blockCode | Name of the current block |
| blockNum | Number of the current block |
| trialCode | Name of the current trial |
| trialNum | Number of the current trial |
| computerStrategy | The strategy the computer uses to make its choice (determined by experimenter) 1 = 'cooperation': selects the cooperative strategy X on every round 2 = 'competition': simply defects on every round of every game by choosing the non-cooperative strategy Y 3 = 'random': selects randomly 4 = 'tit-for-tat': cooperates on first round then mirrors the players choices from the previous rounds 5 = 'tit-for-two-tats': computer cooperates until 2 defects in a row and does not cooperate again until player does 6 = 'probabilistic': cooperates on first round, then selects the strategy that is most often used by player ( if player has selected the cooperative strategy exactly 50% of the time, computer selects cooperative strategy) |
| countRounds | Counts the number of game roun ds played |
| pattern | This script uses 3 formulas to calculate the PDG matrix values (1-3) see below (section Experimental SetUp to get more information on the patterns) |
| player1XPlayer2X | Stores the points won by participant if participant (player1 ) chooses X and computer (player2) chooses X |
| player2XPlayer1X | Stores the points won by computer if participant chooses X and computer chooses X |
| player1XPlayer2Y | Stores the points won by participant if participant chooses X and computer chooses Y |
| player2YPlayer1X | Stores the points won by computer if participant chooses X and computer chooses Y |
| player1YPlayer2Y | Stores the points won by participant if participant chooses Y and computer chooses Y |
| player2YPlayer1Y | Stores the points won by computer if participant chooses Y and computer chooses Y |
| player1YPlayer2X | Stores the points won by participant if participant chooses Y and computer chooses X |
| player2XPlayer1Y | Stores the points won by computer if participant chooses Y and computer chooses X |
| response | The participant's response (response box selected: X vs. Y) |
| correct | Accuracy of response: 1 = correct response; 0 = otherwise |
| list.practiceAcc.mean | Proportion correct during the current practice block |
| latency | The response latency (in ms); measured from: onset of PDG matrix |
| selectedStrategy | Stores the participant selected strategy (X or Y) on the current trial |
| coplayerStrategy | Stores the computer strategy selected on the current trial (X or Y) |
| totalPlayer | Stores the total points won by participant at the end of the current trial |
| totalCoplayer | Stores the total points won by computer at the end of the current trial |
| countConsecutiveY | Counts the number of consecutive selections of competitive strategy (Y) |
| previousPlayerStrategy | Stores the strategy participant selected on the previous trial (X or Y) |
| previousCoplayerStrategy | Stores the computer strategy selected on the previous trial (X or Y) |
| propCoOperation | Proportion of cooperation strategy (X) selections |
| propCompetition | Proportion of competition strategy (Y) selections |
The procedure can be adjusted by setting the following parameters.
| Name | Description | Default |
|---|---|---|
| maxPracticeBlocks | The maximum number of times participants have to go through the matrix practice block before the script aborts due to low understanding (participants move on from practice only with 100% correct understanding of matrix) (default: 10) | |
| usePDGMatrixPractice | True (1): the practice session uses PDG outcome matrices (default) false (0): the practice session uses randomly outcome matrices | |
| numberOfGames | The number of games played (see also expressions.numberGamesInstruct) | 1 |
| computerStrategy | The strategy the computer uses to make its choice 1 = 'cooperation': selects the cooperative strategy X on every round 2 = 'competition': simply defects on every round of every game by choosing the non-cooperative strategy Y 3 = 'random': selects randomly 4 = 'tit-for-tat': cooperates on first round then mirrors the players choices from the previous rounds 5 = 'tit-for-two-tats': computer cooperates until 2 defects in a row and does not cooperate again until player does 6 = 'probabilistic': cooperates on first round, then selects the strategy that is most often used by player ( if player has selected the cooperative strategy exactly 50% of the time, computer selects cooperative strategy) | |
| waitDuration | The duration (in ms) that participant has to wait to get 'paired' | 5000ms |
| iti | Intertrial interval (in ms) | 1000ms |