from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'Round1_agent' players_per_group = None num_rounds = 1 roundnumber = 1 highpayoff = c(550) lowpayoff = c(0) probability_c0 = 5 probability_c0com = 95 probability_c1 = 30 probability_c1com = 70 probability_c2 = 45 probability_c2com = 55 probability_c3 = 55 probability_c3com = 45 correct_Puzzles1 = c(1) correct_Puzzles2 = c(3) correct_Puzzles3 = c(6) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Puzzles1 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], blank=True ) Puzzles2 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], blank=True ) Puzzles3 = models.IntegerField( choices=[1, 2, 3, 4, 5, 6, 7, 8], blank=True ) SelfBelief1 = models.IntegerField( choices=[0, 1, 2, 3] ) SelfBelief2 = models.IntegerField( choices=[ [1, Constants.lowpayoff], [2, Constants.highpayoff], ], widget=widgets.RadioSelectHorizontal ) SelfBelief3 = models.FloatField(min=0, max=100) Puzzles_Q1_correct = models.IntegerField() Puzzles_Q2_correct = models.IntegerField() Puzzles_Q3_correct = models.IntegerField() total = models.IntegerField() def set_payoff1(self): if Constants.correct_Puzzles1 == self.Puzzles1: self.Puzzles_Q1_correct = 1 * 1 if not Constants.correct_Puzzles1 == self.Puzzles1: self.Puzzles_Q1_correct = 0 * 0 def set_payoff2(self): if Constants.correct_Puzzles2 == self.Puzzles2: self.Puzzles_Q2_correct = 1 * 1 if not Constants.correct_Puzzles2 == self.Puzzles2: self.Puzzles_Q2_correct = 0 * 0 def set_payoff3(self): if Constants.correct_Puzzles3 == self.Puzzles3: self.Puzzles_Q3_correct = 1 * 1 if not Constants.correct_Puzzles2 == self.Puzzles2: self.Puzzles_Q3_correct = 0 * 0 def set_payoff_total(self): if self.Puzzles_Q1_correct + self.Puzzles_Q2_correct + self.Puzzles_Q3_correct == 3: self.total = 3 if self.Puzzles_Q1_correct + self.Puzzles_Q2_correct + self.Puzzles_Q3_correct == 2: self.total = 2 if self.Puzzles_Q1_correct + self.Puzzles_Q2_correct + self.Puzzles_Q3_correct == 1: self.total = 1 if self.Puzzles_Q1_correct + self.Puzzles_Q2_correct + self.Puzzles_Q3_correct == 0: self.total = 0