from otree.api import * doc = """ Trade-off game, tAkdeniz & Mathew, 2022, Normative versus prosocial underpinnings of human decision making. """ class Constants(BaseConstants): name_in_url = 'part1task6eq_2' players_per_group = None num_rounds = 1 payoff_a = 250 num_tokens = 100 token_b = 5 token_c = 1 sit = 8 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): tog_eq = models.IntegerField( min=0, max=Constants.num_tokens, label='How many points do you want to send to Participant B (and the remaining points will be ' 'sent to Participant C)?', ) ex1 = models.CurrencyField( doc="""Answer to first example""", min=0, max=Constants.num_tokens*Constants.token_b, label="", ) ex2 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.num_tokens*Constants.token_b, label="", ) ex3 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.num_tokens*Constants.token_b, label="", ) ex4 = models.CurrencyField( doc="""Answer to first example""", min=0, max=Constants.num_tokens*Constants.token_b, label="", ) ex5 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.num_tokens*Constants.token_b, label="", ) ex6 = models.CurrencyField( doc="""Answer to second example""", min=0, max=Constants.num_tokens*Constants.token_b, label="", ) # PAGES class Start(Page): pass class Instructions(Page): form_model = 'player' form_fields = ['ex4', 'ex5', 'ex6'] def error_message(self, value): if value["ex4"] != 250: return 'The first question is not answered correctly. Consult the instructions and try again.' elif value["ex5"] != 100: return 'The second question is not answered correctly. Consult the instructions and try again.' elif value["ex6"] != 80: return 'The third question is not answered correctly. Consult the instructions and try again.' class StartTask(Page): pass class Round1(Page): form_model = 'player' form_fields = ['tog_eq'] class Round2(Page): pass class Round3(Page): pass page_sequence = [Start, Instructions, StartTask, Round1, Round2, Round3]