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 = 'beauty_contest' players_per_group = 3 num_rounds = 1 instructions_template = 'beauty_contest/instructions.html' test_answer=10 class Subsession(BaseSubsession): pass class Group(BaseGroup): mean_payoff=models.FloatField() def set_payoffs(self): self.mean_payoff = sum([p.Beauty_contest for p in self.get_players()])/Constants.players_per_group for p in self.get_players(): p.d=abs((self.mean_payoff*2/3)-p.Beauty_contest) p.payoff=20-(p.d*0.5) class Player(BasePlayer): test=models.FloatField( label="", ) Beauty_contest = models.IntegerField( min=1, max=100, label="", ) Confidence= models.IntegerField( choices=[0,1,2,3,4,5,6,7,8,9,10], label="", widget=widgets.RadioSelectHorizontal ) Payoff_choice=models.StringField( choices=[['A','80 percent strategy 20 percent sure payoff'],['B','20 percent strategy 80 percent sure payoff']], label="", widget=widgets.RadioSelect ) d=models.FloatField() gain=models.FloatField() trole =models.IntegerField() def other_player(self): return self.get_others_in_group()[0]