from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import csv import numpy doc = """ This is a one-shot "Prisoner's Dilemma". Two players are asked separately whether they want to cooperate or defect. Their choices directly determine the payoffs. """ class Constants(BaseConstants): name_in_url = 'strategic_draft1c' players_per_group = 2 players_per_supergroup = 4 num_rounds = 1 continuation_prob = '35%' delta_limit = 35 other_players_in_group = 3 # rematch_prob = '33%' # payoff if 1 player defects and the other cooperates""", betray_payoff = c(100) betrayed_payoff = c(10) # payoff if both players cooperate or both defect both_cooperate_payoff = c(73) both_defect_payoff = c(43) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): cq2_group_members = models.IntegerField( label="(a) Before you start playing groups will be formed. How many people will be in each group?") cq2_match_termination = models.IntegerField( label="(b) The length of each match is:", choices=[[1, 'Pre-determined'], [2, 'Randomly determined']] ) cq2_cont_prob = models.IntegerField( label="(c) After each round, what is the probability that the match will continue for another round?", min=0, max=100) cq2_within_matching = models.IntegerField( label="(d) If a match lasts for more than one round, will you play with the same person for the entire match?", choices=[[1, 'Yes'], [2, 'No']]) cq2_payoff_match_bothcoop = models.IntegerField( label="(e) What is your overall payoff from match # if match # lasted two rounds and both you and\ your partner chose X in both rounds?") cq2_payoff_match_bothdef = models.IntegerField( label="(f) What is your overall payoff from match # if match # lasted two rounds and both you and\ your partner chose Y in both rounds?") cq2_payoff_match_sucker = models.IntegerField( label="(g) Who is better off in match # if match # lasted two rounds and in both rounds\ you chose X and your partner chose Y?", choices=[[1, 'Me'], [2, 'The other player']] )