from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'TreatmentA2' PLAYERS_PER_GROUP = 6 NUM_ROUNDS = 1 A1 = 134 A2 = 111 A3 = 160 A4 = 117 A5 = 75 A6 = 107 A7 = 158 A8 = 60 A9 = 103 A10 = 156 class Subsession(BaseSubsession): pass class Group(BaseGroup): THRD = models.IntegerField(initial=0, max=6, min=0) class Player(BasePlayer): Type = models.StringField(choices=[['A', 'A'], ['B', 'B']], label='Please Select your type', widget=widgets.RadioSelectHorizontal) Comp1 = models.StringField(choices=[['Considerate', 'Considerate'], ['Playful', 'Playful'], ['Obnoxious', 'Obnoxious'], ['Motivated', 'Motivated']], label='Which trait best describes Jake based on the text?', widget=widgets.RadioSelect) Comp2 = models.StringField(choices=[['Entertain', 'Entertain'], ['Persuade', 'Persuade'], ['Inform', 'Inform']], label="What is the author's purpose?", widget=widgets.RadioSelect) Comp3 = models.StringField(choices=[['adjusted', 'adjusted'], ['boldly', 'boldly'], ['curved', 'curved'], ['brim', 'brim']], label='What is the verb in this sentence?', widget=widgets.RadioSelect) Comp4 = models.StringField(choices=[['Person Versus Person', 'Person Versus Person'], ['Person Versus Self', 'Person Versus Self'], ['Person Versus Society', 'Person Versus Society'], ['Person Versus Nature', 'Person Versus Nature'], ['Person Versus Supernatural', 'Person Versus Supernatural'], ['Person Versus Technology', 'Person Versus Technology']], label='Which type of conflict is described above?', widget=widgets.RadioSelect) Comp5 = models.StringField(choices=[['The speaker is appreciating the park.', 'The speaker is appreciating the park.'], ['The speaker is complaining about work.', 'The speaker is complaining about work.'], ['The speaker is enjoying a concert.', 'The speaker is enjoying a concert.'], ['The speaker is rushing through traffic.', 'The speaker is rushing through traffic.']], label='What is this poem about?', widget=widgets.RadioSelect) Effort = models.CurrencyField(blank=True) ANS1 = models.IntegerField(label='83 + 51=') ANS2 = models.IntegerField(label='49 + 62 =') ANS3 = models.IntegerField(label='73 + 87 =') ANS4 = models.IntegerField(label='92 + 25 =') ANS5 = models.IntegerField(label='52 + 23 =') ANS6 = models.IntegerField(label='68 + 39 =') ANS7 = models.IntegerField(label='97 + 61 =') ANS8 = models.IntegerField(label='46 + 14 =') ANS9 = models.IntegerField(label='35 + 68 =') ANS10 = models.IntegerField(label='69 + 87 =') Firstdraw = models.LongStringField() Seconddraw = models.LongStringField() Thirddraw = models.LongStringField() PLAVALUE = models.IntegerField() MULTIPLIYER1 = models.FloatField() NETEFFORT1 = models.FloatField() Multiplier111 = models.LongStringField() BNS1 = models.IntegerField(label='53 + 64 =') BNS2 = models.IntegerField(label='78 + 95 =') BNS3 = models.IntegerField(label='23 + 34 =') BNS5 = models.IntegerField(label='53 + 45 =') BNS6 = models.IntegerField(label='67 + 84 =') BNS7 = models.IntegerField(label='58 + 37 =') BNS8 = models.IntegerField(label='95 + 67 =') BNS9 = models.IntegerField(label='24 + 87 =') BNS10 = models.IntegerField(label='13 + 66 =') NETEFFORT2 = models.FloatField() BNS4 = models.IntegerField(label='78 + 76 =') THRDROUND = models.StringField(choices=[['Participate in the math task and be paid according to the table above.', 'Participate in the math task and be paid according to the table above.'], ['Opt out of the task and be paid $1.50.', 'Opt out of the task and be paid $1.50.']], label='Which do you choose?', widget=widgets.RadioSelect) PAYoffExit = models.FloatField() CNS1 = models.IntegerField(label='28 + 75 =') CNS2 = models.IntegerField(label='64 + 31 =') CNS3 = models.IntegerField(label='34 + 21 =') CNS4 = models.IntegerField(label='54 + 67 =') CNS5 = models.IntegerField(label='25 + 83 =') CNS6 = models.IntegerField(label='27 + 92 =') CNS7 = models.IntegerField(label='79 + 96 =') CNS8 = models.IntegerField(label='38 + 75 =') CNS9 = models.IntegerField(label='30 + 78 =') CNS10 = models.IntegerField(label='37 + 34 =') ANS11 = models.IntegerField(label='23 + 47 =') ANS12 = models.IntegerField(label='14 + 68 =') ANS13 = models.IntegerField(label='56 + 32 =') ANS14 = models.IntegerField(label='14 + 89 =') ANS15 = models.IntegerField(label='45 + 78 =') ANS16 = models.IntegerField(label='19 + 73 =') ANS17 = models.IntegerField(label='67 + 29 =') ANS18 = models.IntegerField(label='54 + 36 =') ANS19 = models.IntegerField(label='12 + 88 =') ANS20 = models.IntegerField(label='63 + 41 =') BNS11 = models.IntegerField(label='42 + 57 =') BNS12 = models.IntegerField(label='26 + 39 =') BNS13 = models.IntegerField(label='18 + 65 =') BNS14 = models.IntegerField(label='76 + 24 =') BNS15 = models.IntegerField(label='31 + 53 =') BNS16 = models.IntegerField(label='49 + 71 =') BNS17 = models.IntegerField(label='62 + 17 =') BNS18 = models.IntegerField(label='83 + 92 =') BNS19 = models.IntegerField(label='55 + 46 =') BNS20 = models.IntegerField(label='70 + 13 =') CNS11 = models.IntegerField(label='28 + 76 =') CNS12 = models.IntegerField(label='51 + 93 =') CNS13 = models.IntegerField(label='64 + 22 =') CNS14 = models.IntegerField(label='35 + 84 =') CNS15 = models.IntegerField(label='19 + 47 =') CNS16 = models.IntegerField(label='58 + 31=') CNS17 = models.IntegerField(label='72 + 68 =') CNS19 = models.IntegerField(label='76 + 12 =') CNS20 = models.IntegerField(label='33 + 88 =') CNS18 = models.IntegerField(label='42 + 55 =') PAY1 = models.FloatField() PAY2 = models.FloatField() PAY3 = models.FloatField() FAIR = models.StringField(choices=[['Very unfair', 'Very unfair'], ['Somewhat unfair', 'Somewhat unfair'], ['Somewhat fair', 'Somewhat fair'], ['Very fair', 'Very fair']], label='1.\tHow fair did you find the method of distributing payment based on your type?', widget=widgets.RadioSelect) EXPL = models.LongStringField(blank=True, label='Why do you think the method of distributing payment based on your type was unfair/fair?') Money = models.FloatField() class INSTRUCTION(Page): form_model = 'player' class INSTRUCTION2(Page): form_model = 'player' form_fields = ['Type'] class Type(Page): form_model = 'player' class CompQ1(Page): form_model = 'player' form_fields = ['Comp1'] class CompQ2(Page): form_model = 'player' form_fields = ['Comp2'] class CompQ3(Page): form_model = 'player' form_fields = ['Comp3'] class CompQ4(Page): form_model = 'player' form_fields = ['Comp4'] class COMPQ5(Page): form_model = 'player' form_fields = ['Comp5'] class YourType(Page): form_model = 'player' class MatHTASK1(Page): form_model = 'player' form_fields = ['ANS1', 'ANS2', 'ANS3', 'ANS4', 'ANS5', 'ANS6', 'ANS7', 'ANS8', 'ANS9', 'ANS10', 'ANS11', 'ANS12'] timeout_seconds = 180 @staticmethod def vars_for_template(player: Player): import random AVALUE = random.randint(0,1) player.PLAVALUE=AVALUE return{ "colour":AVALUE } @staticmethod def before_next_page(player: Player, timeout_happened): player.Effort=25*((player.ANS1==134)+(player.ANS2==111)+(player.ANS3==160)+(player.ANS4==117)+(player.ANS5==75)+(player.ANS6==107)+(player.ANS7==158)+(player.ANS8==60)+(player.ANS9==103)+(player.ANS10==156)+(player.ANS11==70)+(player.ANS12==82)) if player.PLAVALUE==0: player.Firstdraw ="white" else: player.Firstdraw ="Black" if player.PLAVALUE==0 and player.Type=="A": player.MULTIPLIYER1=1/3 player.Multiplier111="1/3" elif player.PLAVALUE==1 and player.Type=="A": player.MULTIPLIYER1=1 player.Multiplier111="1" elif player.PLAVALUE==0 and player.Type=="B": player.MULTIPLIYER1=1 player.Multiplier111="1" elif player.PLAVALUE==1 and player.Type=="B": player.MULTIPLIYER1=1/3 player.Multiplier111="1/3" player.NETEFFORT1=player.MULTIPLIYER1*player.Effort player.NETEFFORT1= round(player.NETEFFORT1) player.PAY1=player.NETEFFORT1/100 player.Money=25+player.NETEFFORT1*1/100 class MyPage6(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.Firstdraw =="Black" class RNDOMDRAW(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.Firstdraw =="white" class MyPage3(Page): form_model = 'player' class MATHTSK2(Page): form_model = 'player' form_fields = ['BNS1', 'BNS2', 'BNS3', 'BNS10', 'BNS9', 'BNS8', 'BNS7', 'BNS6', 'BNS5', 'BNS4', 'BNS12', 'BNS11'] timeout_seconds = 180 @staticmethod def vars_for_template(player: Player): import random AVALUE = random.randint(0,1) player.PLAVALUE=AVALUE return{ "colour":AVALUE } @staticmethod def before_next_page(player: Player, timeout_happened): player.Effort=25*((player.BNS1==117)+(player.BNS2==173)+(player.BNS3==57)+(player.BNS4==154)+(player.BNS5==98)+(player.BNS6==151)+(player.BNS7==95)+(player.BNS8==162)+(player.BNS9==102)+(player.BNS10==79)+(player.BNS11==99)+(player.BNS12==65)) if player.PLAVALUE==0: player.Firstdraw ="white" else: player.Firstdraw ="Black" if player.PLAVALUE==0 and player.Type=="A": player.MULTIPLIYER1=1/3 player.Multiplier111="1/3" elif player.PLAVALUE==1 and player.Type=="A": player.MULTIPLIYER1=1 player.Multiplier111="1" elif player.PLAVALUE==0 and player.Type=="B": player.MULTIPLIYER1=1 player.Multiplier111="1" elif player.PLAVALUE==1 and player.Type=="B": player.MULTIPLIYER1=1/3 player.Multiplier111="1/3" player.NETEFFORT2=player.MULTIPLIYER1*player.Effort player.NETEFFORT2=round(player.NETEFFORT2) player.PAY2=player.NETEFFORT2/100 player.Money=player.Money+player.NETEFFORT2*1/100 player.PAYoffExit=player.Money+1.5 player.PAYoffExit=round(player.PAYoffExit,2) class RNDOMDRAW2(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.Firstdraw =="Black" class RNDOM(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.Firstdraw =="white" class MyPage(Page): form_model = 'player' class Thrdround(Page): form_model = 'player' form_fields = ['THRDROUND'] @staticmethod def before_next_page(player: Player, timeout_happened): pass class THIRDTASK(Page): form_model = 'player' form_fields = ['CNS1', 'CNS2', 'CNS3', 'CNS4', 'CNS5', 'CNS6', 'CNS7', 'CNS8', 'CNS9', 'CNS10', 'CNS12', 'CNS11'] timeout_seconds = 180 @staticmethod def is_displayed(player: Player): return player.THRDROUND=="Participate in the math task and be paid according to the table above." @staticmethod def vars_for_template(player: Player): import random AVALUE = random.randint(0,1) player.PLAVALUE=AVALUE return{ "colour":AVALUE } @staticmethod def before_next_page(player: Player, timeout_happened): group = player.group player.Effort=25*((player.CNS1==103)+(player.CNS2==95)+(player.CNS3==55)+(player.CNS4==121)+(player.CNS5==108)+(player.CNS6==119)+(player.CNS7==175)+(player.CNS8==113)+(player.CNS9==108)+(player.CNS10==71)+(player.CNS11==104)+(player.CNS12==144)) if player.PLAVALUE==0: player.Firstdraw ="white" else: player.Firstdraw ="Black" if player.PLAVALUE==0 and player.Type=="A": player.MULTIPLIYER1=0.33 player.Multiplier111="1/3" elif player.PLAVALUE==1 and player.Type=="A": player.MULTIPLIYER1=0.33 player.Multiplier111="1/3" elif player.PLAVALUE==0 and player.Type=="B": player.MULTIPLIYER1=1 player.Multiplier111="1" elif player.PLAVALUE==1 and player.Type=="B": player.MULTIPLIYER1=0.33 player.Multiplier111="1/3" player.NETEFFORT2=player.MULTIPLIYER1*player.Effort group.THRD=group.THRD +(player.THRDROUND=="Participate in the math task and be paid according to the table above.") class RANDOM3(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.Firstdraw =="Black" class RANDOM4(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.Firstdraw =="white" class Waiting(WaitPage): title_text = '' body_text = 'Waiting for other players in your group to answer' @staticmethod def is_displayed(player: Player): return player.THRDROUND=="Participate in the math task and be paid according to the table above." class Effort(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.THRDROUND !="Participate in the math task and be paid according to the table above." class MyPage2(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.THRDROUND=="Participate in the math task and be paid according to the table above." @staticmethod def before_next_page(player: Player, timeout_happened): group = player.group player.PAYoffExit=player.NETEFFORT2-group.THRD*player.MULTIPLIYER1*12.5 player.PAYoffExit = int(player.PAYoffExit) player.PAY3=player.PAYoffExit/100 player.Money=player.Money+player.PAY3 class MyPage4(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.THRDROUND=="Participate in the math task and be paid according to the table above." class FEEDBAK(Page): form_model = 'player' form_fields = ['FAIR', 'EXPL'] page_sequence = [INSTRUCTION, INSTRUCTION2, Type, CompQ1, CompQ2, CompQ3, CompQ4, COMPQ5, YourType, MatHTASK1, MyPage6, RNDOMDRAW, MyPage3, MATHTSK2, RNDOMDRAW2, RNDOM, MyPage, Thrdround, THIRDTASK, RANDOM3, RANDOM4, Waiting, Effort, MyPage2, MyPage4, FEEDBAK]