from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random class Constants(BaseConstants): name_in_url = "Game_Self_Cheating" players_per_group = None num_rounds = 1 num_tasks = 3 Win_rate_Piecerate = 0.5 Win_rate_Self_tournament = 1 coinflip = 0 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Choice = models.StringField( choices=[["1", "方案(1):如果您选择此任务进行补偿并且此任务最终被随机选上,您将获得按报告的数据每个矩阵0.5元计的赢利。"], ["2", "方案(2):如果您选择此任务进行补偿并且此任务最终被随机选上,同时您在任务3后报告了比任务2中更多的矩阵,将按每一个矩阵奖励1元,否则什么都没有。如果和任务一报告数量一样,按照每一个矩阵获得0.5元奖励。"]], label="请选择您希望通过方案(1)或方案(2)来获得补偿。", widget=widgets.RadioSelect, ) paying_round = models.IntegerField(initial=0) payout_round1 = models.CurrencyField(initial=-1) payout_round2 = models.CurrencyField(initial=-1) payout_round3 = models.CurrencyField(initial=-1) coinflip_if_equal_task2 = models.FloatField(initial=0) coinflip_if_equal_task3 = models.FloatField(initial=0) Nsolved1NEW = models.IntegerField(label="我解决了", max=20, min=0) Nsolved2NEW = models.IntegerField(label="我解决了", max=20, min=0) Nsolved3NEW = models.IntegerField(label="我解决了", max=20, min=0) Experiment_ID = models.IntegerField(label="请输入您的编号") def Final_Payout(self): if self.paying_round == 1: return self.payout_round1 if self.paying_round == 2: return self.payout_round2 if self.paying_round == 3: return self.payout_round3 pass