from otree.api import * c = cu doc = '' class Constants(BaseConstants): name_in_url = 'norm' players_per_group = None num_rounds = 1 task1 = cu(120) task2 = cu(140) task3 = cu(160) task4 = cu(180) task5 = cu(200) task6 = cu(-120) task7 = cu(-140) task8 = cu(-160) task9 = cu(-180) task10 = cu(-200) instructions_template = 'norm/instructions.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def set_payoff(player): import random offer1 = 11+(abs(player.discloure1 - Constants.task1)) offer2 = 11+(abs(player.discloure2 - Constants.task2)) offer3 = 11+(abs(player.discloure3 - Constants.task3)) offer4 = 11+(abs(player.discloure4 - Constants.task4)) offer5 = 11+(abs(player.discloure5 - Constants.task5)) offer6 = 11+(abs(player.discloure6 - Constants.task6)) offer7 = 11+(abs(player.discloure7 - Constants.task7)) offer8 = 11+(abs(player.discloure8 - Constants.task8)) offer9 = 11+(abs(player.discloure9 - Constants.task9)) offer10 = 11+(abs(player.discloure10 - Constants.task10)) offer = [offer1,offer2,offer3,offer4,offer5,offer6,offer7,offer8,offer9,offer10] player.payoff = random.choice(offer) class Player(BasePlayer): discloure1 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=130, min=110) discloure2 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=150, min=130) discloure3 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=170, min=150) discloure4 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=190, min=170) discloure5 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=210, min=190) discloure6 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=-110, min=-130) discloure7 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=-130, min=-150) discloure8 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=-150, min=-170) discloure9 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=-170, min=-190) discloure10 = models.FloatField(label='公司本年度实现的净利润为(单位:百万元)', max=-190, min=-210) norm1 = models.LongStringField(label='') norm2 = models.LongStringField(label='') age = models.IntegerField(label='1.您的年龄', max=50, min=18) lastname = models.StringField(label='2.您的姓氏') gender = models.StringField(choices=[['1', '男'], ['2', '女']], label='3.您的性别', widget=widgets.RadioSelectHorizontal) degree = models.StringField(choices=[['1', '本科生'], ['2', '硕士研究生'], ['3', 'MBA'], ['4', '博士研究生']], label='4.您的学历', widget=widgets.RadioSelectHorizontal) major = models.StringField(label='5.您目前所修专业') grade = models.StringField(label='6.您的年级') course = models.StringField(label='7.您学过多少门会计财务相关的课程') university = models.StringField(label='8.您所在大学') work = models.StringField(label='9.您有关会计财务的实习或工作时间约(年)') hometown = models.StringField(choices=[['1', '大城市'], ['2', '中等城镇'], ['3', '小城镇'], ['4', '农村']], label='10.您来自', widget=widgets.RadioSelectHorizontal) income = models.StringField(choices=[['1', '5千元以下'], ['2', '5千-1万'], ['3', '1万-3万'], ['4', '3万-6万'], ['5', '6万以上']], label='11.您家庭年人均收入', widget=widgets.RadioSelectHorizontal) fatherjob = models.StringField(choices=[['1', '党政机关'], ['2', '科教文卫'], ['3', '三资企业'], ['4', '国企'], ['5', '私企'], ['6', '下岗待业'], ['7', '农民'], ['8', '其他']], label='12.您父亲职业 ', widget=widgets.RadioSelectHorizontal) motherjob = models.StringField(choices=[['1', '党政机关'], ['2', '科教文卫'], ['3', '三资企业'], ['4', '国企'], ['5', '私企'], ['6', '下岗待业'], ['7', '农民'], ['8', '其他']], label='13.您母亲职业', widget=widgets.RadioSelectHorizontal) fatherdegree = models.StringField(choices=[['1', '小学'], ['2', '初中'], ['3', '高中、中专'], ['4', '大专'], ['5', '大学本科'], ['6', '研究生及以上学历']], label='14.您父亲学历', widget=widgets.RadioSelectHorizontal) motherdegree = models.StringField(choices=[['1', '小学'], ['2', '初中'], ['3', '高中、中专'], ['4', '大专'], ['5', '大学本科'], ['6', '研究生及以上学历']], label='15.您母亲学历', widget=widgets.RadioSelectHorizontal) pay = models.StringField(label='16.您的收款账号(请填写支付宝账号)') b0 = models.StringField(blank=True, choices=[['1', '绝对不同意'], ['2', '非常不同意'], ['3', '基本不同意'], ['4', '不确定'], ['5', '基本同意'], ['6', '非常同意'], ['7', '绝对同意']], label='我认为自己.....', widget=widgets.RadioSelectHorizontal) b1 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='1.外向的,精力充沛的', widget=widgets.RadioSelectHorizontal) b2 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='2.爱批评人的,爱争吵的', widget=widgets.RadioSelectHorizontal) b3 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='3.可信赖的,自律的', widget=widgets.RadioSelectHorizontal) b4 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='4.忧虑的,易心烦的', widget=widgets.RadioSelectHorizontal) b5 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='5.易接受新事物的,常有新想法的', widget=widgets.RadioSelectHorizontal) b6 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='6.内向的,安静的', widget=widgets.RadioSelectHorizontal) b7 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='7.招人喜爱的,友善的', widget=widgets.RadioSelectHorizontal) b8 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='8.条理性差的,粗心的', widget=widgets.RadioSelectHorizontal) b9 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='9.冷静的,情绪稳定的', widget=widgets.RadioSelectHorizontal) b10 = models.StringField(choices=[['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7']], label='10.遵循常规的,不爱创新的', widget=widgets.RadioSelectHorizontal) s1 = models.StringField(choices=[['1', 'A.自己获得480,他人获得80。'], ['2', 'B.自己获得540,他人获得280。'], ['3', 'C.自己获得480,他人获得480。']], label='1.情境1', widget=widgets.RadioSelect) s2 = models.StringField(choices=[['1', 'A.自己获得560,他人获得300。'], ['2', 'B.自己获得500,他人获得500。'], ['3', 'C.自己获得500,他人获得100。']], label='2.情境2', widget=widgets.RadioSelect) s3 = models.StringField(choices=[['1', 'A.自己获得520,他人获得520。'], ['2', 'B.自己获得520,他人获得120。'], ['3', 'C.自己获得580,他人获得320。']], label='3.情境3', widget=widgets.RadioSelect) s4 = models.StringField(choices=[['1', 'A.自己获得500,他人获得100。'], ['2', 'B.自己获得560,他人获得300。'], ['3', 'C.自己获得490,他人获得490。']], label='4.情境4', widget=widgets.RadioSelect) s5 = models.StringField(choices=[['1', 'A.自己获得560,他人获得300。'], ['2', 'B.自己获得500,他人获得500。'], ['3', 'C.自己获得490,他人获得90。']], label='5.情境5', widget=widgets.RadioSelect) s6 = models.StringField(choices=[['1', 'A.自己获得500,他人获得500。'], ['2', 'B.自己获得500,他人获得100。'], ['3', 'C.自己获得570,他人获得300。']], label='6.情境6', widget=widgets.RadioSelect) s7 = models.StringField(choices=[['1', 'A.自己获得510,他人获得510。'], ['2', 'B.自己获得560,他人获得300。'], ['3', 'C.自己获得510,他人获得110。']], label='7.情境7', widget=widgets.RadioSelect) s8 = models.StringField(choices=[['1', 'A.自己获得550,他人获得300。'], ['2', 'B.自己获得500,他人获得100。'], ['3', 'C.自己获得500,他人获得500。']], label='8.情境8', widget=widgets.RadioSelect) s9 = models.StringField(choices=[['1', 'A.自己获得480,他人获得100。'], ['2', 'B.自己获得490,他人获得490。'], ['3', 'C.自己获得540,他人获得300。']], label='9.情境9', widget=widgets.RadioSelect) set_payoff = set_payoff class Introduction(Page): form_model = 'player' class Pre_task(Page): form_model = 'player' class Norm1(Page): form_model = 'player' form_fields = ['norm1'] class Task1(Page): form_model = 'player' form_fields = ['discloure1'] class Task2(Page): form_model = 'player' form_fields = ['discloure2'] class Task3(Page): form_model = 'player' form_fields = ['discloure3'] class Task4(Page): form_model = 'player' form_fields = ['discloure4'] class Task5(Page): form_model = 'player' form_fields = ['discloure5'] class Norm2(Page): form_model = 'player' form_fields = ['norm2'] class Task6(Page): form_model = 'player' form_fields = ['discloure6'] class Task7(Page): form_model = 'player' form_fields = ['discloure7'] class Task8(Page): form_model = 'player' form_fields = ['discloure8'] class Task9(Page): form_model = 'player' form_fields = ['discloure9'] class Task10(Page): form_model = 'player' form_fields = ['discloure10'] class BFI_10(Page): form_model = 'player' form_fields = ['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'b10'] class SVO(Page): form_model = 'player' form_fields = ['s1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9'] class Demographics(Page): form_model = 'player' form_fields = ['age', 'lastname', 'gender', 'degree', 'major', 'grade', 'course', 'university', 'work', 'hometown', 'income', 'fatherjob', 'motherjob', 'fatherdegree', 'motherdegree', 'pay'] class Results(Page): form_model = 'player' @staticmethod def vars_for_template(player): return set_payoff(player) page_sequence = [Introduction, Pre_task, Norm1, Task1, Task2, Task3, Task4, Task5, Norm2, Task6, Task7, Task8, Task9, Task10, BFI_10, SVO, Demographics, Results]