from otree.api import * doc = """ Estimation Task """ class Constants(BaseConstants): name_in_url = 'estimation_task' players_per_group = None num_rounds = 1 true_difficulty_10 = 90 true_difficulty_50 = 50 true_difficulty_90 = 10 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): estimated_performance = models.IntegerField( label="本番ラウンドでのあなたの平均獲得ポイントはいくらだと思いますか?", blank=False ) estimated_higher = models.IntegerField( label="以前大阪大学で同様の実験に参加した人達から、無作為に100人を選びました。選ばれた100人のうち、本番ラウンドでの平均獲得ポイントがあなたの平均獲得ポイントより高かった人は何人だと思いますか?(なお、あなたと同点の人は数に含めないでください)", blank=False ) subjective_difficulty_10 = models.IntegerField( label= "以前大阪大学で同様の実験に参加した人達から、無作為に100人を選びました。選ばれた100人のうち、本番ラウンドでの平均獲得ポイントが357より高かった人は何人だと思いますか?(なお、357ポイントの人は数に含めないでください)", blank=False ) subjective_difficulty_50 = models.IntegerField( label= "以前大阪大学で同様の実験に参加した人達から、無作為に100人を選びました。選ばれた100人のうち、本番ラウンドでの平均獲得ポイントが453より高かった人は何人だと思いますか?(なお、453ポイントの人は数に含めないでください)", blank=False ) subjective_difficulty_90 = models.IntegerField( label= "以前大阪大学で同様の実験に参加した人達から、無作為に100人を選びました。選ばれた100人のうち、本番ラウンドでの平均獲得ポイントが567より高かった人は何人だと思いますか?(なお、567ポイントの人は数に含めないでください)", blank=False ) q1_point = models.FloatField() q2_point = models.FloatField() q3_point = models.FloatField() q4_point = models.FloatField() q5_point = models.FloatField() def set_payoffs(player: Player): player.q1_point = 700 + ((player.estimated_performance - player.participant.vars['avg_point']) ** 2) / 3 player.q2_point = 700 + ((player.estimated_higher - player.participant.vars['true_higher']) ** 2) / 3 player.q3_point = 700 + ((player.subjective_difficulty_10 - Constants.true_difficulty_10) ** 2) / 3 player.q4_point = 700 + ((player.subjective_difficulty_50 - Constants.true_difficulty_50) ** 2) / 3 player.q5_point = 700 + ((player.subjective_difficulty_90 - Constants.true_difficulty_90) ** 2) / 3 player.participant.vars['point_list'][4] = player.q1_point player.participant.vars['point_list'][5] = player.q2_point player.participant.vars['point_list'][6] = player.q3_point player.participant.vars['point_list'][7] = player.q4_point player.participant.vars['point_list'][8] = player.q5_point # PAGES class Estimation(Page): form_model = 'player' form_fields = ['estimated_performance', 'estimated_higher', 'subjective_difficulty_10', 'subjective_difficulty_50', 'subjective_difficulty_90'] class Endpage_Estimation(Page): def before_next_page(player: Player, timeout_happened): set_payoffs(player) page_sequence = [Estimation, Endpage_Estimation]