from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'condition3' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 ACTIVE_ROLE = 'active player' PASSIVE_ROLE = 'passive player' class Subsession(BaseSubsession): @staticmethod def creating_session(subsession): subsession.group_randomly(fixed_id_in_group=True) print(subsession.get_group_matrix()) class Group(BaseGroup): @staticmethod def set_payoffs(groups): Active = group.get_player_by_role(C.ACTIVE_ROLE) Passive = group.get_player_by_role(C.PASSIVE_ROLE) class Player(BasePlayer): Sabotage = models.StringField(initial=0, label='Would you like to sabotage your opponent’s performance by adding 30 seconds to his or her time?', choices=["Yes, I would like to sabotage my opponent’s performance.", "No, I would not like to sabotage my opponent’s performance."]) competition = models.StringField(label='Which scheme would you like to choose in case condition 3 applies?', choices=["Competition Scheme", "Individual Scheme"]) belief_Sabotage = models.IntegerField(min=0 , max=100, label='How many passive players out of 100 do you think will choose the sabotage option (between 0 to 100)? You will earn an extra 50 cents if the true number is within +5 to -5 number of your answer. ' ) # PAGES class Condition3(Page): form_model = 'player' form_fields = ["competition"] @staticmethod def is_displayed(player: Player): return player.role == C.ACTIVE_ROLE class Condition3p(Page): form_model = 'player' form_fields = ["Sabotage"] @staticmethod def is_displayed(player: Player): return player.role == C.PASSIVE_ROLE class Results1(Page): form_model = 'player' form_fields = ["belief_Sabotage"] @staticmethod def is_displayed(player): return player.role == C.ACTIVE_ROLE page_sequence = [Condition3, Condition3p, Results1 ]