from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random class Constants(BaseConstants): name_in_url = 'survey_jung' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_field_risk(fosho,heads): return models.IntegerField( choices=[[1,f'${fosho}'], [2,f'A fair coin flip in which you get ${heads} if it is heads, $0 if it is tails.']], label='Which do you prefer?', widget=widgets.RadioSelect, ) class Player(BasePlayer): #############demographics age = models.IntegerField( label='What is your age?', min=13, max=125) gender = models.StringField( choices=['Female', 'Male', 'Other'], label='What is your gender?', widget=widgets.RadioSelectHorizontal) education = models.StringField( choices = ['Social Sciences and Economics','Literature','Science','Others'], label = 'What is your field of study?', widget = widgets.RadioSelect ) lab_exp = models.IntegerField( choices= [[1,'Yes'], [0,'No']], label = 'Have you already participated into any lab experiment before?', widget = widgets.RadioSelect ) hob_game = models.IntegerField( choices = [[1,'Yes'],[0,'No']], label = 'Do you play games as a hobby?', widget = widgets.RadioSelect ) game_how_often = models.StringField( choices = ['None', 'Barely', 'Once a week', 'More often than once a week', 'Almost everyday'], label = 'How often do you play games?', widget = widgets.RadioSelect ) #############Risk Aversion risk1 = make_field_risk('50','200') risk2 = make_field_risk('75','200') risk3 = make_field_risk('100','200') risk4 = make_field_risk('125','200') risk5 = make_field_risk('150','200') #############Ambiguity Aversion amb = models.IntegerField( choices=[[1,""" Lottery A: There are 100 balls in a box. You know that 50 of them are black and 50 of them are red. If you draw a red one, you get $10; if you draw a black one, you pay $10."""], [2,""" Lottery B: There are 100 balls in a box. You know that they are black and red but you don’t know how many of them are red or black. If you draw a red one, you get $10; if you draw a black one, you pay $10."""]], label=''' Which lottery will you prefer to participate?''', widget = widgets.RadioSelect ) # amb2 = models.IntegerField( # label=''' # "If it takes 5 machines 5 minutes to make 5 widgets, # how many minutes would it take 100 machines to make 100 widgets?" # ''' # ) # # amb3 = models.IntegerField( # label=''' # In a lake, there is a patch of lily pads. # Every day, the patch doubles in size. # If it takes 48 days for the patch to cover the entire lake, # how many days would it take for the patch to cover half of the lake? # ''' # )