from otree.api import * import time class C(BaseConstants): NAME_IN_URL = 'CRTSurvey' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 Prize_correct = 0.5 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Demographics and comments age = models.IntegerField(label='What is your age?', min=18, max=125) gender = models.StringField( choices=[['Male', 'Male'], ['Female', 'Female'], ['Other', 'Other'], ['Prefer not to say', 'Prefer not to say']], label='What is your gender?', widget=widgets.RadioSelect, ) statistics_before = models.BooleanField( label='Have you taken any course that includes Game Theory ', choices=[ [False, 'No'], [True, 'Yes'], ], widget=widgets.RadioSelect, ) difficulty = models.StringField( choices=[['Very difficult', 'Very difficult'], ['Difficult', 'Difficult'], ['Easy', 'Easy'], ['Very easy', 'Very easy']], label='How difficult the experiment was?', widget=widgets.RadioSelect, ) open_comment = models.StringField(label='Please indicate any comment you have about the experiment:') time_demographics = models.IntegerField() # FUNCTIONS def set_payoffs(group): p1 = group.get_player_by_id(1) p2 = group.get_player_by_id(2) p1.correct_relative_performance = 1 * (p1.crt_better == p2.crt_performance) p2.correct_relative_performance = 1 * (p2.crt_better == p1.crt_performance) class Demographics(Page): form_model = 'player' form_fields = ['age', 'gender', 'statistics_before', 'difficulty', 'open_comment', ] page_sequence = [Demographics]