from otree.api import * c = Currency doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'trustor' players_per_group = 2 num_rounds = 1 class Player(BasePlayer): is_trustor = models.BooleanField(initial=False) decision1 = models.FloatField(label="What is the lowest p such that you would choose B?", min=0, max=1) decision2 = models.FloatField(label="What is the lowest p such that you would choose B?", min=0, max=1) decision3 = models.FloatField(label="What is the lowest p such that you would choose B?", min=0, max=1) decision4 = models.StringField(label="Player 1 actually chose to trust you and played B. What are you going to choose?", choices=[ '1', '2', ]) gender = models.StringField(label="Please indicate your gender", choices=[ 'Male', 'Female', 'Other' ]) age = models.IntegerField(label="How old are you?") home = models.StringField(label="Where do you live?") family = models.StringField(label="What is your family status?", choices=[ 'Single', 'Married', 'Divorced', 'Widowed', 'Registered Life Partnership', 'Other' ]) profession = models.StringField(label="What is your profession?", choices=[ 'Pensioner', 'Employee', 'I am unemployed', 'Self-employed', 'Civil Servant', 'Pupil', 'Student', 'I live on income from capital assets or rent', 'Other' ]) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def set_start(player: Player): if player.id_in_group==1: player.is_trustor=True # PAGES class Welcome(Page): pass @staticmethod def before_next_page(player:Player,timeout_happened): set_start(player) class Instructions(Page): pass class PersonalQuestions(Page): form_model='player' form_fields=['gender','age','home','family','profession'] class DecisionProblem (Page): form_model='player' form_fields=['decision1'] @staticmethod def is_displayed(player: Player): return player.is_trustor class RiskyDictatorGame (Page): form_model='player' form_fields=['decision2'] @staticmethod def is_displayed(player: Player): return player.is_trustor class TrustGame (Page): form_model='player' form_fields=['decision3'] @staticmethod def is_displayed(player: Player): return player.is_trustor class TrustGameTrustee (Page): form_model='player' form_fields=['decision4'] @staticmethod def is_displayed(player: Player): return not player.is_trustor class ThankYou (Page): pass page_sequence = [Welcome, Instructions, PersonalQuestions, DecisionProblem, RiskyDictatorGame, TrustGame, TrustGameTrustee, ThankYou]