from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer ) import csv author = 'Eveline Vandewal' doc = """ Polonio's Strategic Games """ class Constants(BaseConstants): name_in_url = 'MTSP_Part1A' players_per_group = None with open('MTSP_Part1A/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() problem_type = models.IntegerField() payoff_a = models.IntegerField() payoff_b = models.IntegerField() payoff_c = models.IntegerField() payoff_d = models.IntegerField() payoff_e = models.IntegerField() payoff_f = models.IntegerField() payoff_g = models.IntegerField() payoff_h = models.IntegerField() randomized_order = models.IntegerField() colors_reversed = models.IntegerField() roles_reversed = models.IntegerField() q1 = models.IntegerField( choices=[ [1, 'ROW PARTICIPANT'], [2, 'COLUMN PARTICIPANT'] ], widget=widgets.RadioSelect ) q2 = models.IntegerField() q3 = models.IntegerField() q1_error = models.BooleanField() q2_error = models.BooleanField() q3_error = models.BooleanField() q4 = models.IntegerField( widget=widgets.RadioSelect ) q5 = models.IntegerField( choices=[ [1, 'Yes'], [2, 'No'] ], widget=widgets.RadioSelect ) q4_error = models.BooleanField() q5_error = models.BooleanField() cq_error = models.BooleanField() practice_submitted_choice = models.IntegerField( widget=widgets.RadioSelect ) practice_submitted_belief = models.IntegerField() clicks_a = models.TextField(blank=True) clicks_b = models.TextField(blank=True) clicks_c = models.TextField(blank=True) clicks_d = models.TextField(blank=True) clicks_e = models.TextField(blank=True) clicks_f = models.TextField(blank=True) clicks_g = models.TextField(blank=True) clicks_h = models.TextField(blank=True) submitted_choice = models.IntegerField( widget=widgets.RadioSelect ) submitted_belief = models.IntegerField() submitted_time = models.FloatField() def current_problem(self): return self.participant.vars['randomized_problems1'][self.round_number - 1]