from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer ) import csv author = 'Eveline Vandewal' doc = """ Bruhin's Dictator Games """ class Constants(BaseConstants): name_in_url = 'MTSP_Part2' players_per_group = None with open('MTSP_Part2/problems.csv') as problems_file: problems = list(csv.DictReader(problems_file)) num_rounds = len(problems) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): problem_id = models.IntegerField() x_you = models.IntegerField() x_other = models.IntegerField() y_you = models.IntegerField() y_other = models.IntegerField() randomized_order = models.IntegerField() colors_reversed = models.IntegerField() options_reversed = models.IntegerField() q1 = models.IntegerField( choices=[ [1, 'Yes'], [2, 'No'] ], widget=widgets.RadioSelect ) q2 = models.IntegerField() q3 = models.IntegerField() q1_error = models.BooleanField() q2_error = models.BooleanField() q3_error = models.BooleanField() cq_error = models.BooleanField() practice_submitted_choice1 = models.IntegerField( choices=[ [1, 'Distribution X'], [2, 'Distribution Y'] ], widget=widgets.RadioSelect ) practice_submitted_choice2 = models.IntegerField( choices=[ [1, 'Distribution X'], [2, 'Distribution Y'] ], widget=widgets.RadioSelect ) clicks_a = models.TextField(blank=True) clicks_b = models.TextField(blank=True) clicks_c = models.TextField(blank=True) clicks_d = models.TextField(blank=True) submitted_choice = models.IntegerField( choices=[ [1, 'Distribution X'], [2, 'Distribution Y'] ], widget=widgets.RadioSelect ) submitted_time = models.FloatField() def current_problem(self): return self.participant.vars['randomized_problems2'][self.round_number - 1]