from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) author = 'Wang Song' doc = """ Instructions for the general rule regardless of the treatment """ class Constants(BaseConstants): name_in_url = 'exp_instructions' players_per_group = None num_rounds = 1 instructions_template = 'exp_instructions/summary_as_template.html' num_Afailure = 2 num_Bfailure = 6 endowment = c(4) period_income_healthy = c(3) # earn $3 if survived period_income_death = c(-1) # loss $1 if not survived parents_care = 0.5 candidate_donation_cost = [0.5, 2] minutes_for_timeout = 5 # 5 minutes minutes_for_endofround = 35 # 35 minutes minutes_for_dice = 5 # 5 minutes quiz1ans = 3 quiz2ans = 4 quiz3ans = 3 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): quiz1 = models.IntegerField( widget=widgets.RadioSelect, choices=[ [1, str(Constants.period_income_healthy)+' (minus your cost of donating if you are a donor)'], [2, str(Constants.endowment)+' (minus your cost of donating if you are a donor)'], [3, str(Constants.endowment+Constants.period_income_healthy)+' (minus your cost of donating if you are a donor)'], [4, str(Constants.endowment+Constants.endowment)+' (minus your cost of donating if you are a donor)'], ], blank=True ) quiz2 = models.IntegerField( widget=widgets.RadioSelect, choices=[2, 4, 6, 8], blank=True ) quiz3 = models.IntegerField( widget=widgets.RadioSelect, choices=[ [1, 'A, A'], [2, 'A, B'], [3, 'B, A'], [4, 'B, B'], ], blank=True ) def set_payoff(self): self.payoff = 0