from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'Copy' PLAYERS_PER_GROUP = 3 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/2X. ', 'Opt out of the task and be paid 1/2X. ']], 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 =') 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'] 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)) 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=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=0.33 player.Multiplier111="1/3" player.NETEFFORT1=player.MULTIPLIYER1*player.Effort class MyPage3(Page): form_model = 'player' class MATHTSK2(Page): form_model = 'player' form_fields = ['BNS1', 'BNS2', 'BNS3', 'BNS10', 'BNS9', 'BNS8', 'BNS7', 'BNS6', 'BNS5', 'BNS4'] 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)) 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=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=0.33 player.Multiplier111="1/3" player.NETEFFORT2=player.MULTIPLIYER1*player.Effort player.PAYoffExit=player.NETEFFORT2/2 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'] 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)) 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" 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 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) 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 MyPage5(Page): form_model = 'player' page_sequence = [INSTRUCTION, INSTRUCTION2, Type, CompQ1, CompQ2, CompQ3, CompQ4, COMPQ5, YourType, MatHTASK1, MyPage3, MATHTSK2, MyPage, Thrdround, THIRDTASK, Waiting, Effort, MyPage2, MyPage4, MyPage5]