from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, # Currency as c, currency_range Currency as c, ) import random doc = """ This is an iterated Prisoner's Dilemma where players play against a computer player that executes a particular strategy. """ class Constants(BaseConstants): name_in_url = 'pre1' players_per_group = None # players_per_group = 1 num_rounds = 1 instructions_template = 'pre_survey1/instructions.html' # payoff if 1 player defects and the other cooperates""", betray_payoff = c(300) betrayed_payoff = c(0) # payoff if both players cooperate or both defect both_cooperate_payoff = c(200) both_defect_payoff = c(50) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): cooperative = models.IntegerField( label='To what extent do you agree with the following statement: "I tend to be cooperative."', choices=[ [1, 'Strongly agree'], [2, 'Agree'], [3, 'Neutral'], [4, 'Disagree'], [5, 'Strongly disagree'], ], widget=widgets.RadioSelect ) exp_payoff = models.CurrencyField( label='What do you think your total payoff at the end of each session (15 rounds per session) will be? ' 'The instructions and payoffs are reproduced below for your reference' )