Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Table of Contents
Here, we consider a simple bi-matrix game example, with continuous, discrete & one-shot games -- with heat-map (mixed-strategy) & 2x2 matrix (pure strategy) selectors. This experiment is based on “A Continuous Dilemma” by Dan Friedman & Ryan Oprea (AER 2011)
With this example we take the basic bi-matrix prisoner’s dilemma game that any economist should be familiar with, and build a continuous time game with ConG -- in the process exploring some of the options experimenters have with the software.
Although it is in both players’ mutual interest to cooperate (both choosing “Don’t Confess”) it is not individually rational to do so.
(The example below is one treatment in “A Continuous Dilemma”)
- This is a symmetric 2x2 bimatrix.. - Since the game is symmetric, note that only four values need to be defined, the payoffs associated with all four possible action combinations.
First, you need to download the following the most recent version of ConG, a .ZIP file, here. It contains an executable JAVA file called "Test.JAR" that will load & execute the experiment below.
You'll also need to download the comma separated variables (.csv) configuration file. This file provides ConG with a "game definition" that defines fully how the experiment will run: the number of periods, whether or not periods are run in continuous or discrete time, the payoff functions used, how subjects interact with the server & each other, and how information is displayed. This config file can be found at the following link, prisoners_dilemma.csv.
The configuration file starts with a header row, followed by rows that sequentially define each of the various edifying treatments we'll discuss below. Each period has its own row in the config file, and each period can be thought as its own game with its own payoff function and display, and its own beginning and end. Variations in periods/rows result in variations in the game users experience.
Download, open and fully unzip the ConG Package.
1. Double-click on Test.JAR 2. Select '''''2''''' as the Number of Subjects. 3. Leave "Open GL" checked (''if your computer, for some reason, can't use Open GL and crashes, please kindly upgrade your computer'') 4. Click the "Start" button 5. You should see the one Control window & two Client windows pop up on your computer. 6. After these three windows have opened, click on the Control window 7. Note in the Control window that the two Clients have connected as client_1 test, client_2 test. 8. Click on "Load Period Config" in the bottom of the Control window. 9. Select the [https://github.com/Leeps-Lab/ConG/blob/master/wiki-images/ConG_Dilemma/prisoners_dilemma.csv prisoners_dilemma.csv] file 10. Each Treatment below is a "Period" in the experiment you've just loaded. 11. As you work through the following treatments, it is useful to open the prisoners_dilemma CSV file defining this game -- and following along with it through each treatment.
System Requirements - Although the test experiment should be able to run on most computers and laptops, you may want to check the System Requirements
In each treatment below, periods last 60 seconds.
The table below outlines the header and first "period definition" row of the prisoners_dilemma.csv config file we've loaded.
- In continuous time, any change in player’s strategy results in an instantaneous change in player’s payoffs (with a difficult to notice fifty-millisecond response time). Players observe the history of actions and payouts unfold before them graphically. At the end of the 60-second period, players earn the integral of the flow payoffs shown in their history (refer to screenshot). In one sense, continuous time is a discrete time game with 20+ sub-periods each second (for the 60-second game above, that would have subperiods>1200) and a one-shot game is the discrete time set-up with subperiods=1. - period - Period number of the game. With a typical lab session there are multiple periods; practice rounds, treatment variations, shifting of player matches and the like. - paid - We have set paid=TRUE, meaning each player's actions in this round will be added to their final [wiki:paying_subjects] calculations. If we wanted to have a practice round or two -- a period in which subjects got a chance to risklessly play before the actual experiment begins -- one would set "paid" to "FALSE". - length - Refers to the number of seconds in the period. Here the period lasts one minute, 60-seconds. - subperiods sets the option for continuous or discrete time. For a continuous time experiment, set subperiods to 0. See the ConG Treatment of Continuous Time page if interested in these technical details. - blank fields - mixed, matrixDisplay, showHeatmapLegend - we'll be playing with these fields later. As blank, they turn to their default; mixed="FALSE", matrixDisplay="HeatmapSingle" and "showHeatmapLegend="FALSE" - percentChangePerSecond set to NaN, meaning changes in one's strategy are instantaneously reflected on the user's screen.
The table below outlines the second "period definition" row of the prisoners_dilemma.csv config file we've loaded.
- During the 60-second strategy selection period players may freely switch between strategy options, however payoffs will only be calculated based on the strategy selected at the end of the 60-second period. Subjects do not observe the strategy choice of their counterpart until the period’s end. They earn the lump sum payoffs for the action profile chosen at that point. - period We are in period two now. - length The length remains at 60 seconds. - subperiods We have set the number of subperiods to 1. This means that CONG will not be running in continuous time and will divide the period length into 1 subperiod, so there will be one subperiod of 60 seconds. - percentChangePerSecond This is set to NaN in discrete time, since the strategy of each player is unknown to the other in discrete time.
Figure - In the figure below we can see player one has unfortunately selected the non-dominant strategy and the second player is reaping the benefits. Current earnings and previous earnings are visible and are incidentally the same for the one-shot game. The "pure" selector with choices between strategies A and B is clearly visible as well as the 2x2 payoff matrix of this prisoner's dilemma game.
The table below outlines the third "period definition" row of the prisoners_dilemma.csv config file we've loaded.
- Here, the sixty second period is divided into six, thirty-second subperiods. Payoffs in each subperiod are determined solely by the strategy chosen at the end of the ten-second subperiod. And only at the end of the subperiod do players observe their counterpart’s strategy choice. Player payouts are the integral across subperiods of the piecewise flow payments. - length The length of this period is once again set to 60 seconds. - subperiods The 60-second period is divided into a grid of n subperiods. In this case there are 6 subperiods. Meaning each subperiod in the game is 10 seconds in length.
(Note) subperiods establishes the number of subperiods in the game, NOT the length of the subperiod. If n=subperiods and T=length, then length of the subperiod =T/n
Figure - Below we see six bars representing the payoffs of each of the six rounds. The current and previous earnings of the player are visible as well as the "pure" selector.
The table below outlines the fourth "period definition" row of the prisoners_dilemma.csv config file we've loaded.
- Experimenters should be careful to ensure colorblind subjects play the game carefully. They may not be able to see correctly the heatmap selector below. - mixed is set to TRUE. This allows subjects to selected mixed (non-pure) strategies. Note that the default settings for mixed is FALSE, meaning that if no column for mixed is included, users will only be able to select pure strategies. - selector This option enable the player to use the heatmap to change their strategy as opposed to the default option, pure. - matrixDisplay We have set this to "HeatmapSingle" which is the default display for heatmaps. We will discuss this option more in the Heatmap Both treatment. - showHeatmapLegend We have set this to TRUE so it displays the heatmap legend. We will go into more detail about this option in further sections.
Figure - The colorful heatmap selector is clearly displayed for the player with payoff information on the edges. In this screenshot the subject using this client has chosen to cooperate, while the counterpart player has chosen to defect, resulting in zero flow points going to this player (while the counterpart player earns 18 points).
The table below outlines the fifth "period definition" row of the prisoners_dilemma.csv config file we've loaded.
- Known !Bug/Issue with Corners - Please read if you plan to implement a heatmap experiment using the "corners" display. There appears to be an issue with the current version of ConG if "corners" display is used in a period after a period in which the heatmap was visible. Sometimes if a "corner" period (a period in which the experimenter wishes to suppress heatmap information) follows a "heatmap" period (a period in which the heatmap is visible), then sometimes the heatmap is visible on client terminals (when is should be white space). --Therefore, experimenters who wish to mixed between "corners" and "heatmap" periods should ensure the config has all "corners" periods precede heatmap periods.
- In this treatment there is no heat map, it only tells you payoff info in the corners. Players can choose mixed strategies (up for cooperate, down for defect again). - selector - this field is set to "heatmap2d" as per usual (though the heatmap is not visible the selector functions the same way). - matrixDisplay - is set to "corners"
Figure - Compared to the previous period, players have the same selector and see the exact same thing - short the heatmap. Thus, with corners "matrixDisplay", possibly valuable information about potential payoffs is not visible to subjects. Only the corner payoffs of pure strategy selections visible.
The table below outlines the sixth "period definition" row of the prisoners_dilemma.csv config file we've loaded.
- This treatment displays two heatmaps one of which shows how your actions affect the payoffs of the other player's. In discrete time, it gets tricky. For each player's perspective, they are always a 'row' player, meaning players only move up and down, along the y-axis. - selector - as per usual this is set to "heatmap2d" - matrixDisplay- this field is set to "HeatmapBoth"
Figure - The second heatmap above the primary heatmap can be seen in the upper left corner. This is where the player can view the other player's payoffs.
= Output Files
- ConG test.jar experiments and sessions run on networked computers produce five output files, - payouts.csv - a period by period account of points earned by each subject. - ticks - a .csv log of subject actions. - client and server errors - a log of errors. - ip_address.csv Output files are discussed fully here, ConG Output Files
Below is a list, and brief explanations of each field in the "game definition" prisoners_dilemma.csv config file use for this experiment.
- period - [1-n] Integer field which designates the period number.
- paid - [TRUE] Boolean field which determines whether the point from the round are counted towards the player's payoff.
- length - [1-n] Integer field which determines the length(in seconds) of the entire period.
- [wiki:confusion#subperiods] - [0-n] Integer field. When set to zero the game will be in continuous time. When set to greater than 0 the total period length in seconds will be divided by the number of subperiods. So for length=300 and subperiods=5 there will be five subperiods of 300/5 (one minute) length.
- percentChangePerSecond - [NaN] or [0,Inf] When the period is in discrete time the percentChangePerSecond field is not applicable. When the period is in discrete time this determines the rate at which players can change their strategy. For example, when this field is set to .1 the players can change their strategy via the selector by a maximum of 10% per second.
- groupSize - [1-n] Integer field which determines the number of players in each group. The group size is determined by dividing the number of players.
- matchType - "pair" or "self". Default value is self, so be sure to put "pair" if prisoner's dilemma game. For more, [wiki:Grouping].
- payoffFunction - This field requires specific entries that designate the payoff function of the game. For the Prisoner's Dilemma game we use the payoff function "matrix2x2". The following fields set parameters for the "matrix2x2" function.
- name - set to "first", subject's computer will prompt players for their first name before the game. (However, this is not done with the Test.JAR demo to avoid overload of windows. You're welcome.)
- min - Integer field. Along with 'max', this scales the flow payoffs display chart. This value notes the smallest value plotted on the Y-axis
- max - Integer field. Along with 'min', this scales the flow payoffs display chart. This value notes the largest value plotted on the Y-axis
- Aa - Integer field that sets the payoff for each player when both select strategy A.
- Ab - Integer field that sets the payoff when player 1 selects strategy A and player 2 selects strategy B.
- Ba - Integer field that sets the payoff when player 1 selects strategy B and player 2 selects strategy A.
- Bb - Integer field that sets the payoff when both players select strategy B.
- mixed - [TRUE] Boolean field that determines whether the players can choose mixed strategies i.e. heatmaps.
- selector - This field requires the specific entry that determines the selectors that players can use. Many of the options for this field are visible in the above treatments. Some examples are "heatmap2d", "pure", "bubble".
- matrixDisplay - some of the options are HeatMapSingle, HeatMapBoth (you can or can't see the other player's heatmap), and corners.
- showHeatmapLegend - this adds a legend next to the payoff recorder, connecting the color in the heatmap to the precise payoff value. (always leave this on)