from otree.api import * import random from otree.models import player c = Currency doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'test1' PLAYERS_PER_GROUP = None NUM_ROUNDS = 54 # before oct 17th, 33. also TASKS are only up to R27 # TASKS = ['R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'R8', 'R9', 'R10', 'R11', 'R12', 'R13', 'R14', 'R15', 'R16', # 'R17', 'R18', 'R19', 'R20', 'R21', 'R22', 'R23', 'R24', 'R25', 'R26', 'R27'] TASKS = ['R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'R8', 'R9', 'R10', 'R11', 'R12', 'R13', 'R14', 'R15', 'R16', 'R17', 'R18', 'R19', 'R20', 'R21', 'R22', 'R23', 'R24', 'R25', 'R26', 'R27', 'L1', 'L2', 'L3', 'L4', 'L5', 'L6', 'L7', 'L8', 'L9', 'L10', 'L11', 'L12', 'L13', 'L14', 'L15', 'L16', 'L17', 'L18', 'L19', 'L20', 'L21', 'L22', 'L23', 'L24', 'L25', 'L26', 'L27' ] # one job, baseline VA_1 = 60 VB_1 = 40 TA_1 = 10 TB_1 = 30 VA_2 = 55 VB_2 = 45 TA_2 = 8 TB_2 = 15 VA_3 = 50 VB_3 = 45 TA_3 = 5 TB_3 = 20 # one job, dom VA_4 = 120 VB_4 = 80 TA_4 = 75 TB_4 = 82 VA_5 = 110 VB_5 = 90 TA_5 = 75 TB_5 = 92 VA_6 = 100 VB_6 = 90 TA_6 = 70 TB_6 = 91 # one job, obv VA_7 = 120 VB_7 = 80 TA_7 = 75 TB_7 = 120 VA_8 = 110 VB_8 = 80 TA_8 = 80 TB_8 = 110 VA_9 = 100 VB_9 = 90 TA_9 = 60 TB_9 = 100 # two jobs, baseline VAA_1 = 100 VAB_1 = 90 VBA_1 = 70 VBB_1 = 80 TAA_1 = 55 TAB_1 = 28 TBA_1 = 65 TBB_1 = 55 VAA_2 = 100 VAB_2 = 90 VBA_2 = 75 VBB_2 = 80 TAA_2 = 60 TAB_2 = 50 TBA_2 = 70 TBB_2 = 65 VAA_3 = 120 VAB_3 = 100 VBA_3 = 80 VBB_3 = 90 TAA_3 = 75 TAB_3 = 70 TBA_3 = 80 TBB_3 = 85 # two jobs dom VAA_4 = 120 VAB_4 = 100 VBA_4 = 50 VBB_4 = 60 TAA_4 = 60 TAB_4 = 45 TBA_4 = 62 TBB_4 = 60 VAA_5 = 130 VAB_5 = 120 VBA_5 = 105 VBB_5 = 110 TAA_5 = 75 TAB_5 = 70 TBA_5 = 112 TBB_5 = 110 VAA_6 = 120 VAB_6 = 90 VBA_6 = 75 VBB_6 = 80 TAA_6 = 85 TAB_6 = 80 TBA_6 = 87 TBB_6 = 80 # two jobs obv VAA_7 = 100 VAB_7 = 80 VBA_7 = 50 VBB_7 = 55 TAA_7 = 60 TAB_7 = 50 TBA_7 = 70 TBB_7 = 65 VAA_8 = 100 VAB_8 = 90 VBA_8 = 50 VBB_8 = 60 TAA_8 = 65 TAB_8 = 60 TBA_8 = 70 TBB_8 = 65 VAA_9 = 120 VAB_9 = 90 VBA_9 = 75 VBB_9 = 77 TAA_9 = 80 TAB_9 = 55 TBA_9 = 85 TBB_9 = 82 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Vars for Profits profit_this_round = models.FloatField() profit_r1 = models.FloatField() profit_r2 = models.FloatField() profit_r3 = models.FloatField() profit_r4 = models.FloatField() profit_r5 = models.FloatField() profit_r6 = models.FloatField() profit_r7 = models.FloatField() profit_r8 = models.FloatField() profit_r9 = models.FloatField() profit2_r1 = models.FloatField() profit2_r2 = models.FloatField() profit2_r3 = models.FloatField() profit2_r4 = models.FloatField() profit2_r5 = models.FloatField() profit2_r6 = models.FloatField() profit2_r7 = models.FloatField() profit2_r8 = models.FloatField() profit2_r9 = models.FloatField() profit3_r1 = models.FloatField() profit3_r2 = models.FloatField() profit3_r3 = models.FloatField() profit3_r4 = models.FloatField() profit3_r5 = models.FloatField() profit3_r6 = models.FloatField() profit3_r7 = models.FloatField() profit3_r8 = models.FloatField() profit3_r9 = models.FloatField() profit_lottery1 = models.FloatField() profit_lottery2 = models.FloatField() profit_lottery3 = models.FloatField() profit_lottery4 = models.FloatField() profit_lottery5 = models.FloatField() profit_lottery6 = models.FloatField() # newly added.. profit_lottery7 = models.FloatField() profit_lottery8 = models.FloatField() profit_lottery9 = models.FloatField() profit_lottery10 = models.FloatField() profit_lottery11 = models.FloatField() profit_lottery12 = models.FloatField() profit_lottery13 = models.FloatField() profit_lottery14 = models.FloatField() profit_lottery15 = models.FloatField() profit_lottery16 = models.FloatField() profit_lottery17 = models.FloatField() profit_lottery18 = models.FloatField() profit_lottery19 = models.FloatField() profit_lottery20 = models.FloatField() profit_lottery21 = models.FloatField() profit_lottery22 = models.FloatField() profit_lottery23 = models.FloatField() profit_lottery24 = models.FloatField() profit_lottery25 = models.FloatField() profit_lottery26 = models.FloatField() profit_lottery27 = models.FloatField() worker_r1 = models.FloatField() worker_r2 = models.FloatField() worker_r3 = models.FloatField() worker_r4 = models.FloatField() worker_r5 = models.FloatField() worker_r6 = models.FloatField() worker_r7 = models.FloatField() worker_r8 = models.FloatField() worker_r9 = models.FloatField() worker2_r1 = models.FloatField() worker2_r2 = models.FloatField() worker2_r3 = models.FloatField() worker2_r4 = models.FloatField() worker2_r5 = models.FloatField() worker2_r6 = models.FloatField() worker2_r7 = models.FloatField() worker2_r8 = models.FloatField() worker2_r9 = models.FloatField() worker3_r1 = models.FloatField() worker3_r2 = models.FloatField() worker3_r3 = models.FloatField() worker3_r4 = models.FloatField() worker3_r5 = models.FloatField() worker3_r6 = models.FloatField() worker3_r7 = models.FloatField() worker3_r8 = models.FloatField() worker3_r9 = models.FloatField() numapply_r1 = models.FloatField() numapply_r2 = models.FloatField() numapply_r3 = models.FloatField() numapply_r4 = models.FloatField() numapply_r5 = models.FloatField() numapply_r6 = models.FloatField() numapply_r7 = models.FloatField() numapply_r8 = models.FloatField() numapply_r9 = models.FloatField() headtail1 = models.FloatField() headtail2 = models.FloatField() headtail3 = models.FloatField() headtail4 = models.FloatField() headtail5 = models.FloatField() headtail6 = models.FloatField() # newly added.. headtail7 = models.FloatField() headtail8 = models.FloatField() headtail9 = models.FloatField() headtail10 = models.FloatField() headtail11 = models.FloatField() headtail12 = models.FloatField() headtail13 = models.FloatField() headtail14 = models.FloatField() headtail15 = models.FloatField() headtail16 = models.FloatField() headtail17 = models.FloatField() headtail18 = models.FloatField() headtail19 = models.FloatField() headtail20 = models.FloatField() headtail21 = models.FloatField() headtail22 = models.FloatField() headtail23 = models.FloatField() headtail24 = models.FloatField() headtail25 = models.FloatField() headtail26 = models.FloatField() headtail27 = models.FloatField() w_1 = models.FloatField( label="Your wage choice is:", max=60 ) w_2 = models.FloatField( label="Your wage choice is:", max=55 ) w_3 = models.FloatField( label="Your wage choice is:", max=50 ) w_4 = models.FloatField( label="Your wage choice is:", max=120 ) w_5 = models.FloatField( label="Your wage choice is:", max=110 ) w_6 = models.FloatField( label="Your wage choice is:", max=100 ) w_7 = models.FloatField( label="Your wage choice is:", max=120 ) w_8 = models.FloatField( label="Your wage choice is:", max=110 ) w_9 = models.FloatField( label="Your wage choice is:", max=100 ) wa_1 = models.FloatField( label="Your wage choice for Job 1 is:", max=100 ) wb_1 = models.FloatField( label="Your wage choice for Job 2 is:", max=90 ) wa_2 = models.FloatField( label="Your wage choice for Job 1 is:", max=100 ) wb_2 = models.FloatField( label="Your wage choice for Job 2 is:", max=90 ) wa_3 = models.FloatField( label="Your wage choice for Job 1 is:", max=120 ) wb_3 = models.FloatField( label="Your wage choice for Job 2 is:", max=100 ) wa_4 = models.FloatField( label="Your wage choice for Job 1 is:", max=120 ) wb_4 = models.FloatField( label="Your wage choice for Job 2 is:", max=100 ) wa_5 = models.FloatField( label="Your wage choice for Job 1 is:", max=130 ) wb_5 = models.FloatField( label="Your wage choice for Job 2 is:", max=120 ) wa_6 = models.FloatField( label="Your wage choice for Job 1 is:", max=120 ) wb_6 = models.FloatField( label="Your wage choice for Job 2 is:", max=90 ) wa_7 = models.FloatField( label="Your wage choice for Job 1 is:", max=100 ) wb_7 = models.FloatField( label="Your wage choice for Job 2 is:", max=80 ) wa_8 = models.FloatField( label="Your wage choice for Job 1 is:", max=100 ) wb_8 = models.FloatField( label="Your wage choice for Job 2 is:", max=90 ) wa_9 = models.FloatField( label="Your wage choice for Job 1 is:", max=120 ) wb_9 = models.FloatField( label="Your wage choice for Job 2 is:", max=90 ) wr_1 = models.FloatField( label="Your wage choice is:", max=60 ) wr_2 = models.FloatField( label="Your wage choice is:", max=55 ) wr_3 = models.FloatField( label="Your wage choice is:", max=50 ) wr_4 = models.FloatField( label="Your wage choice is:", max=120 ) wr_5 = models.FloatField( label="Your wage choice is:", max=110 ) wr_6 = models.FloatField( label="Your wage choice is:", max=100 ) wr_7 = models.FloatField( label="Your wage choice is:", max=120 ) wr_8 = models.FloatField( label="Your wage choice is:", max=110 ) wr_9 = models.FloatField( label="Your wage choice is:", max=100 ) lottery_choice1 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice2 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice3 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice4 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice5 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice6 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice7 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice8 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice9 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice10 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice11 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice12 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice13 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice14 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice15 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice16 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice17 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice18 = models.IntegerField( choices=[[1, "Gamble A"], [2, "Gamble B"], [3, "Gamble C"], [4, "Gamble D"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice19 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice20 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice21 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice22 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice23 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice24 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice25 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice26 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) lottery_choice27 = models.BooleanField( choices=[[True, "Gamble A"], [False, "Gamble B"]], widget=widgets.RadioSelect, label="Your gamble choice is:" ) payment_round = models.IntegerField() def final_payoff(player): player.payment_round = random.randint(1, 54) player.payoff = player.in_round(player.payment_round).profit_this_round # def final_payoff(player): # player.payment_round = random.randint(1, 54) # before oct 17th, (1,33) # player.payment_round2 = player.payment_round # player.payoff = player.in_round(player.payment_round).profit_this_round def creating_session(subsession): if subsession.round_number == 1: for player in subsession.get_players(): a = list(range(1, 28)) b = list(range(28, 55)) # random.shuffle(a) # random.shuffle(b) round_numbers = a + b player.participant.task_rounds = dict(zip(C.TASKS, round_numbers)) # PAGES class Round1_1(Page): form_model = "player" form_fields = ["w_1"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R1'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_1, C.VA_1, C.VB_1, C.TA_1, C.TB_1) player.profit_r1 = temp[0] player.worker_r1 = temp[1] # player.profit_r1 = payoff_1(player.w_1, C.VA_1, C.VB_1, C.TA_1, C.TB_1)[0] # player.worker_r1 = payoff_1(player.w_1, C.VA_1, C.VB_1, C.TA_1, C.TB_1)[1] player.profit_this_round = player.profit_r1 class Round2(Page): form_model = "player" form_fields = ["w_2"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R2'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_2, C.VA_2, C.VB_2, C.TA_2, C.TB_2) player.profit_r2 = temp[0] player.worker_r2 = temp[1] player.profit_this_round = player.profit_r2 class Round3(Page): form_model = "player" form_fields = ["w_3"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R3'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_3, C.VA_3, C.VB_3, C.TA_3, C.TB_3) player.profit_r3 = temp[0] player.worker_r3 = temp[1] player.profit_this_round = player.profit_r3 class Round4(Page): form_model = "player" form_fields = ["w_4"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R4'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_4, C.VA_4, C.VB_4, C.TA_4, C.TB_4) player.profit_r4 = temp[0] player.worker_r4 = temp[1] player.profit_this_round = player.profit_r4 class Round5(Page): form_model = "player" form_fields = ["w_5"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R5'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_5, C.VA_5, C.VB_5, C.TA_5, C.TB_5) player.profit_r5 = temp[0] player.worker_r5 = temp[1] player.profit_this_round = player.profit_r5 class Round6(Page): form_model = "player" form_fields = ["w_6"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R6'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_6, C.VA_6, C.VB_6, C.TA_6, C.TB_6) player.profit_r6 = temp[0] player.worker_r6 = temp[1] player.profit_this_round = player.profit_r6 class Round7(Page): form_model = "player" form_fields = ["w_7"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R7'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_7, C.VA_7, C.VB_7, C.TA_7, C.TB_7) player.profit_r7 = temp[0] player.worker_r7 = temp[1] player.profit_this_round = player.profit_r7 # player.final_payoff() class Round8(Page): form_model = "player" form_fields = ["w_8"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R8'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_8, C.VA_8, C.VB_8, C.TA_8, C.TB_8) player.profit_r8 = temp[0] player.worker_r8 = temp[1] player.profit_this_round = player.profit_r8 class Round9(Page): form_model = "player" form_fields = ["w_9"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R9'] def before_next_page(player, timeout_happened): temp = payoff_1(player.w_9, C.VA_9, C.VB_9, C.TA_9, C.TB_9) player.profit_r9 = temp[0] player.worker_r9 = temp[1] player.profit_this_round = player.profit_r9 class Round10_1(Page): form_model = "player" form_fields = ["wa_1", "wb_1"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R10'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_1, player.wb_1, C.VAA_1, C.VAB_1, C.VBA_1, C.VBB_1, C.TAA_1, C.TAB_1, C.TBA_1, C.TBB_1) player.profit2_r1 = temp[0] player.worker2_r1 = temp[1] player.profit_this_round = player.profit2_r1 class Round11(Page): form_model = "player" form_fields = ["wa_2", "wb_2"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R11'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_2, player.wb_2, C.VAA_2, C.VAB_2, C.VBA_2, C.VBB_2, C.TAA_2, C.TAB_2, C.TBA_2, C.TBB_2) player.profit2_r2 = temp[0] player.worker2_r2 = temp[1] player.profit_this_round = player.profit2_r2 class Round12(Page): form_model = "player" form_fields = ["wa_3", "wb_3"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R12'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_3, player.wb_3, C.VAA_3, C.VAB_3, C.VBA_3, C.VBB_3, C.TAA_3, C.TAB_3, C.TBA_3, C.TBB_3) player.profit2_r3 = temp[0] player.worker2_r3 = temp[1] player.profit_this_round = player.profit2_r3 class Round13(Page): form_model = "player" form_fields = ["wa_4", "wb_4"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R13'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_4, player.wb_4, C.VAA_4, C.VAB_4, C.VBA_4, C.VBB_4, C.TAA_4, C.TAB_4, C.TBA_4, C.TBB_4) player.profit2_r4 = temp[0] player.worker2_r4 = temp[1] player.profit_this_round = player.profit2_r4 class Round14(Page): form_model = "player" form_fields = ["wa_5", "wb_5"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R14'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_5, player.wb_5, C.VAA_5, C.VAB_5, C.VBA_5, C.VBB_5, C.TAA_5, C.TAB_5, C.TBA_5, C.TBB_5) player.profit2_r5 = temp[0] player.worker2_r5 = temp[1] player.profit_this_round = player.profit2_r5 class Round15(Page): form_model = "player" form_fields = ["wa_6", "wb_6"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R15'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_6, player.wb_6, C.VAA_6, C.VAB_6, C.VBA_4, C.VBB_6, C.TAA_6, C.TAB_6, C.TBA_6, C.TBB_6) player.profit2_r6 = temp[0] player.worker2_r6 = temp[1] player.profit_this_round = player.profit2_r6 class Round16(Page): form_model = "player" form_fields = ["wa_7", "wb_7"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R16'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_7, player.wb_7, C.VAA_7, C.VAB_7, C.VBA_7, C.VBB_7, C.TAA_7, C.TAB_7, C.TBA_7, C.TBB_7) player.profit2_r7 = temp[0] player.worker2_r7 = temp[1] player.profit_this_round = player.profit2_r7 class Round17(Page): form_model = "player" form_fields = ["wa_8", "wb_8"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R17'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_8, player.wb_8, C.VAA_8, C.VAB_8, C.VBA_8, C.VBB_8,C.TAA_8, C.TAB_8, C.TBA_8, C.TBB_8) player.profit2_r8 = temp[0] player.profit2_r8 = temp[1] player.profit_this_round = player.profit2_r8 class Round18(Page): form_model = "player" form_fields = ["wa_9", "wb_9"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R18'] def before_next_page(player, timeout_happened): temp = payoff_2(player.wa_9, player.wb_9, C.VAA_9, C.VAB_9, C.VBA_9, C.VBB_9, C.TAA_9, C.TAB_9, C.TBA_9, C.TBB_9) player.profit2_r9 = temp[0] player.worker2_r9 = temp[1] player.profit_this_round = player.profit2_r9 class Round19(Page): form_model = "player" form_fields = ["wr_1"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R19'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_1, C.VA_1, C.VB_1, C.TA_1, C.TB_1) player.profit3_r1 = temp[0] player.worker3_r1 = temp[1] player.numapply_r1 = temp[2] player.profit_this_round = player.profit3_r1 class Round20(Page): form_model = "player" form_fields = ["wr_2"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R20'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_2, C.VA_2, C.VB_2, C.TA_2, C.TB_2) player.profit3_r2 = temp[0] player.worker3_r2 = temp[1] player.numapply_r2 = temp[2] player.profit_this_round = player.profit3_r2 class Round21(Page): form_model = "player" form_fields = ["wr_3"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R21'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_3, C.VA_3, C.VB_3, C.TA_3, C.TB_3) player.profit3_r3 = temp[0] player.worker3_r3 = temp[1] player.numapply_r3 = temp[2] player.profit_this_round = player.profit3_r3 class Round22(Page): form_model = "player" form_fields = ["wr_4"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R22'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_4, C.VA_4, C.VB_4, C.TA_4, C.TB_4) player.profit3_r4 = temp[0] player.worker3_r4 = temp[1] player.numapply_r4 = temp[2] player.profit_this_round = player.profit3_r4 class Round23(Page): form_model = "player" form_fields = ["wr_5"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R23'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_5, C.VA_5, C.VB_5, C.TA_5, C.TB_5) player.profit3_r5 = temp[0] player.worker3_r5 = temp[1] player.numapply_r5 = temp[2] player.profit_this_round = player.profit3_r5 class Round24(Page): form_model = "player" form_fields = ["wr_6"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R24'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_6, C.VA_6, C.VB_6, C.TA_6, C.TB_6) player.profit3_r6 = temp[0] player.worker3_r6 = temp[1] player.numapply_r6 = temp[2] player.profit_this_round = player.profit3_r6 class Round25(Page): form_model = "player" form_fields = ["wr_7"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R25'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_7, C.VA_7, C.VB_7, C.TA_7, C.TB_7) player.profit3_r7 = temp[0] player.worker3_r7 = temp[1] player.numapply_r7 = temp[2] player.profit_this_round = player.profit3_r7 class Round26(Page): form_model = "player" form_fields = ["wr_8"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R26'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_8, C.VA_8, C.VB_8, C.TA_8, C.TB_8) player.profit3_r8 = temp[0] player.worker3_r8 = temp[1] player.numapply_r8 = temp[2] player.profit_this_round = player.profit3_r8 class Round27(Page): form_model = "player" form_fields = ["wr_9"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['R27'] def before_next_page(player, timeout_happened): temp = payoff_3(player.wr_9, C.VA_9, C.VB_9, C.TA_9, C.TB_9) player.profit3_r9 = temp[0] player.worker3_r9 = temp[1] player.numapply_r9 = temp[2] player.profit_this_round = player.profit3_r9 class Lottery1(Page): form_model = "player" form_fields = ["lottery_choice1"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L1'] def vars_for_template(player): return dict( l1a=C.VA_1 - C.TA_1, l1b=0, l2a=C.VA_1 - C.TB_1, l2b=C.VB_1 - C.TB_1, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice1, C.VA_1, C.VB_1, C.TA_1, C.TB_1) player.profit_lottery1 = temp[0] player.headtail1 = temp[1] player.profit_this_round = player.profit_lottery1 if player.participant.task_rounds['L1'] == 54: return player.final_payoff() class Lottery2(Page): form_model = "player" form_fields = ["lottery_choice2"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L2'] def vars_for_template(player): return dict( l1a=C.VA_2 - C.TA_2, l1b=0, l2a=C.VA_2 - C.TB_2, l2b=C.VB_2 - C.TB_2, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice2, C.VA_2, C.VB_2, C.TA_2, C.TB_2) player.profit_lottery2 = temp[0] player.headtail2 = temp[1] player.profit_this_round = player.profit_lottery2 if player.participant.task_rounds['L2'] == 54: return player.final_payoff() class Lottery3(Page): form_model = "player" form_fields = ["lottery_choice3"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L3'] def vars_for_template(player): return dict( l1a=C.VA_3 - C.TA_3, l1b=0, l2a=C.VA_3 - C.TB_3, l2b=C.VB_3 - C.TB_3, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice3, C.VA_3, C.VB_3, C.TA_3, C.TB_3) player.profit_lottery3 = temp[0] player.headtail3 = temp[1] player.profit_this_round = player.profit_lottery3 if player.participant.task_rounds['L3'] == 54: return player.final_payoff() class Lottery4(Page): form_model = "player" form_fields = ["lottery_choice4"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L4'] def vars_for_template(player): return dict( l1a=C.VA_4 - C.TA_4, l1b=0, l2a=C.VA_4 - C.TB_4, l2b=C.VB_4 - C.TB_4, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice4, C.VA_4, C.VB_4, C.TA_4, C.TB_4) player.profit_lottery4 = temp[0] player.headtail4 = temp[1] player.profit_this_round = player.profit_lottery4 if player.participant.task_rounds['L4'] == 54: return player.final_payoff() class Lottery5(Page): form_model = "player" form_fields = ["lottery_choice5"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L5'] def vars_for_template(player): return dict( l1a=C.VA_5 - C.TA_5, l1b=0, l2a=C.VA_5 - C.TB_5, l2b=C.VB_5 - C.TB_5, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice5, C.VA_5, C.VB_5, C.TA_5, C.TB_5) player.profit_lottery5 = temp[0] player.headtail5 = temp[1] player.profit_this_round = player.profit_lottery5 if player.participant.task_rounds['L5'] == 54: return player.final_payoff() class Lottery6(Page): form_model = "player" form_fields = ["lottery_choice6"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L6'] def vars_for_template(player): return dict( l1a=C.VA_6 - C.TA_6, l1b=0, l2a=C.VA_6 - C.TB_6, l2b=C.VB_6 - C.TB_6, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice6, C.VA_6, C.VB_6, C.TA_6, C.TB_6) player.profit_lottery6 = temp[0] player.headtail6 = temp[1] player.profit_this_round = player.profit_lottery6 if player.participant.task_rounds['L6'] == 54: return player.final_payoff() class Lottery7(Page): form_model = "player" form_fields = ["lottery_choice7"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L7'] def vars_for_template(player): return dict( l1a=C.VA_7 - C.TA_7, l1b=0, l2a=C.VA_7 - C.TB_7, l2b=C.VB_7 - C.TB_7, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice7, C.VA_7, C.VB_7, C.TA_7, C.TB_7) player.profit_lottery7 = temp[0] player.headtail7 = temp[1] player.profit_this_round = player.profit_lottery7 if player.participant.task_rounds['L7'] == 54: return player.final_payoff() class Lottery8(Page): form_model = "player" form_fields = ["lottery_choice8"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L8'] def vars_for_template(player): return dict( l1a=C.VA_8 - C.TA_8, l1b=0, l2a=C.VA_8 - C.TB_8, l2b=C.VB_8 - C.TB_8, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice8, C.VA_8, C.VB_8, C.TA_8, C.TB_8) player.profit_lottery8 = temp[0] player.headtail8 = temp[1] player.profit_this_round = player.profit_lottery8 if player.participant.task_rounds['L8'] == 54: return player.final_payoff() class Lottery9(Page): form_model = "player" form_fields = ["lottery_choice9"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L9'] def vars_for_template(player): return dict( l1a=C.VA_9 - C.TA_9, l1b=0, l2a=C.VA_9 - C.TB_9, l2b=C.VB_9 - C.TB_9, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice9, C.VA_9, C.VB_9, C.TA_9, C.TB_9) player.profit_lottery9 = temp[0] player.headtail9 = temp[1] player.profit_this_round = player.profit_lottery9 if player.participant.task_rounds['L9'] == 54: return player.final_payoff() class Lottery10(Page): form_model = "player" form_fields = ["lottery_choice10"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L10'] def vars_for_template(player): return dict( l1a=C.VAA_1 - C.TAA_1, l1b=C.VAB_1 - C.TAB_1, l2a=C.VAA_1 - C.TAA_1 + C.VBB_1 - C.TBB_1, l2b=C.VAB_1 - C.TBB_1, l3a=C.VAA_1 - C.TBA_1, l3b=C.VAB_1 - C.TAB_1 + C.VBA_1 - C.TBA_1, l4a=C.VAA_1 - C.TBA_1 + C.VBB_1 - C.TBB_1, l4b=C.VAB_1 - C.TBB_1 + C.VBA_1 - C.TBA_1, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice10, C.VAA_1, C.VAB_1, C.VBA_1, C.VBB_1, C.TAA_1, C.TAB_1, C.TBA_1, C.TBB_1) player.profit_lottery10 = temp[0] player.headtail10 = temp[1] player.profit_this_round = player.profit_lottery10 if player.participant.task_rounds['L10'] == 54: return player.final_payoff() class Lottery11(Page): form_model = "player" form_fields = ["lottery_choice11"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L11'] def vars_for_template(player): return dict( l1a=C.VAA_2 - C.TAA_2, l1b=C.VAB_2 - C.TAB_2, l2a=C.VAA_2 - C.TAA_2 + C.VBB_2 - C.TBB_2, l2b=C.VAB_2 - C.TBB_2, l3a=C.VAA_2 - C.TBA_2, l3b=C.VAB_2 - C.TAB_2 + C.VBA_2 - C.TBA_2, l4a=C.VAA_2 - C.TBA_2 + C.VBB_2 - C.TBB_2, l4b=C.VAB_2 - C.TBB_2 + C.VBA_2 - C.TBA_2, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice11, C.VAA_2, C.VAB_2, C.VBA_2, C.VBB_2, C.TAA_2, C.TAB_2, C.TBA_2, C.TBB_2) player.profit_lottery11 = temp[0] player.headtail11 = temp[1] player.profit_this_round = player.profit_lottery11 if player.participant.task_rounds['L11'] == 54: return player.final_payoff() class Lottery12(Page): form_model = "player" form_fields = ["lottery_choice12"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L12'] def vars_for_template(player): return dict( l1a=C.VAA_3 - C.TAA_3, l1b=C.VAB_3 - C.TAB_3, l2a=C.VAA_3 - C.TAA_3 + C.VBB_3 - C.TBB_3, l2b=C.VAB_3 - C.TBB_3, l3a=C.VAA_3 - C.TBA_3, l3b=C.VAB_3 - C.TAB_3 + C.VBA_3 - C.TBA_3, l4a=C.VAA_3 - C.TBA_3 + C.VBB_3 - C.TBB_3, l4b=C.VAB_3 - C.TBB_3 + C.VBA_3 - C.TBA_3, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice12, C.VAA_3, C.VAB_3, C.VBA_3, C.VBB_3, C.TAA_3, C.TAB_3, C.TBA_3, C.TBB_3) player.profit_lottery12 = temp[0] player.headtail12 = temp[1] player.profit_this_round = player.profit_lottery12 if player.participant.task_rounds['L12'] == 54: return player.final_payoff() class Lottery13(Page): form_model = "player" form_fields = ["lottery_choice13"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L13'] def vars_for_template(player): return dict( l1a=C.VAA_4 - C.TAA_4, l1b=C.VAB_4 - C.TAB_4, l2a=C.VAA_4 - C.TAA_4 + C.VBB_4 - C.TBB_4, l2b=C.VAB_4 - C.TBB_4, l3a=C.VAA_4 - C.TBA_4, l3b=C.VAB_4 - C.TAB_4 + C.VBA_4 - C.TBA_4, l4a=C.VAA_4 - C.TBA_4 + C.VBB_4 - C.TBB_4, l4b=C.VAB_4 - C.TBB_4 + C.VBA_4 - C.TBA_4, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice13, C.VAA_4, C.VAB_4, C.VBA_4, C.VBB_4, C.TAA_4, C.TAB_4, C.TBA_4, C.TBB_4) player.profit_lottery13 = temp[0] player.headtail13 = temp[1] player.profit_this_round = player.profit_lottery13 if player.participant.task_rounds['L13'] == 54: return player.final_payoff() class Lottery14(Page): form_model = "player" form_fields = ["lottery_choice14"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L14'] def vars_for_template(player): return dict( l1a=C.VAA_5 - C.TAA_5, l1b=C.VAB_5 - C.TAB_5, l2a=C.VAA_5 - C.TAA_5 + C.VBB_5 - C.TBB_5, l2b=C.VAB_5 - C.TBB_5, l3a=C.VAA_5 - C.TBA_5, l3b=C.VAB_5 - C.TAB_5 + C.VBA_5 - C.TBA_5, l4a=C.VAA_5 - C.TBA_5 + C.VBB_5 - C.TBB_5, l4b=C.VAB_5 - C.TBB_5 + C.VBA_5 - C.TBA_5, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice14, C.VAA_5, C.VAB_5, C.VBA_5, C.VBB_5, C.TAA_5, C.TAB_5, C.TBA_5, C.TBB_5) player.profit_lottery14 = temp[0] player.headtail14 = temp[1] player.profit_this_round = player.profit_lottery14 if player.participant.task_rounds['L14'] == 54: return player.final_payoff() class Lottery15(Page): form_model = "player" form_fields = ["lottery_choice15"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L15'] def vars_for_template(player): return dict( l1a=C.VAA_6 - C.TAA_6, l1b=C.VAB_6 - C.TAB_6, l2a=C.VAA_6 - C.TAA_6 + C.VBB_6 - C.TBB_6, l2b=C.VAB_6 - C.TBB_6, l3a=C.VAA_6 - C.TBA_6, l3b=C.VAB_6 - C.TAB_6 + C.VBA_6 - C.TBA_6, l4a=C.VAA_6 - C.TBA_6 + C.VBB_6 - C.TBB_6, l4b=C.VAB_6 - C.TBB_6 + C.VBA_6 - C.TBA_6, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice15, C.VAA_6, C.VAB_6, C.VBA_6, C.VBB_6, C.TAA_6, C.TAB_6, C.TBA_6, C.TBB_6) player.profit_lottery15 = temp[0] player.headtail15 = temp[1] player.profit_this_round = player.profit_lottery15 if player.participant.task_rounds['L15'] == 54: return player.final_payoff() class Lottery16(Page): form_model = "player" form_fields = ["lottery_choice16"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L16'] def vars_for_template(player): return dict( l1a=C.VAA_7 - C.TAA_7, l1b=C.VAB_7 - C.TAB_7, l2a=C.VAA_7 - C.TAA_7 + C.VBB_7 - C.TBB_7, l2b=C.VAB_7 - C.TBB_7, l3a=C.VAA_7 - C.TBA_7, l3b=C.VAB_7 - C.TAB_7 + C.VBA_7 - C.TBA_7, l4a=C.VAA_7 - C.TBA_7 + C.VBB_7 - C.TBB_7, l4b=C.VAB_7 - C.TBB_7 + C.VBA_7 - C.TBA_7, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice16, C.VAA_7, C.VAB_7, C.VBA_7, C.VBB_7, C.TAA_7, C.TAB_7, C.TBA_7, C.TBB_7) player.profit_lottery16 = temp[0] player.headtail16 = temp[1] player.profit_this_round = player.profit_lottery16 if player.participant.task_rounds['L16'] == 54: return player.final_payoff() class Lottery17(Page): form_model = "player" form_fields = ["lottery_choice17"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L17'] def vars_for_template(player): return dict( l1a=C.VAA_8 - C.TAA_8, l1b=C.VAB_8 - C.TAB_8, l2a=C.VAA_8 - C.TAA_8 + C.VBB_8 - C.TBB_8, l2b=C.VAB_8 - C.TBB_8, l3a=C.VAA_8 - C.TBA_8, l3b=C.VAB_8 - C.TAB_8 + C.VBA_8 - C.TBA_8, l4a=C.VAA_8 - C.TBA_8 + C.VBB_8 - C.TBB_8, l4b=C.VAB_8 - C.TBB_8 + C.VBA_8 - C.TBA_8, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice17, C.VAA_8, C.VAB_8, C.VBA_8, C.VBB_8, C.TAA_8, C.TAB_8, C.TBA_8, C.TBB_8) player.profit_lottery17 = temp[0] player.headtail17 = temp[1] player.profit_this_round = player.profit_lottery17 if player.participant.task_rounds['L17'] == 54: return player.final_payoff() class Lottery18(Page): form_model = "player" form_fields = ["lottery_choice18"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L18'] def vars_for_template(player): return dict( l1a=C.VAA_9 - C.TAA_9, l1b=C.VAB_9 - C.TAB_9, l2a=C.VAA_9 - C.TAA_9 + C.VBB_9 - C.TBB_9, l2b=C.VAB_9 - C.TBB_9, l3a=C.VAA_9 - C.TBA_9, l3b=C.VAB_9 - C.TAB_9 + C.VBA_9 - C.TBA_9, l4a=C.VAA_9 - C.TBA_9 + C.VBB_9 - C.TBB_9, l4b=C.VAB_9 - C.TBB_9 + C.VBA_9 - C.TBA_9, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_2(player.lottery_choice18, C.VAA_9, C.VAB_9, C.VBA_9, C.VBB_9, C.TAA_9, C.TAB_9, C.TBA_9, C.TBB_9) player.profit_lottery18 = temp[0] player.headtail18 = temp[1] player.profit_this_round = player.profit_lottery18 if player.participant.task_rounds['L18'] == 54: return player.final_payoff() class Lottery19(Page): form_model = "player" form_fields = ["lottery_choice19"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L19'] def vars_for_template(player): return dict( l1a=C.VA_1 - C.TA_1, l1b=0, l2a=C.VA_1 - C.TB_1, l2b=C.VB_1 - C.TB_1, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice19, C.VA_1, C.VB_1, C.TA_1, C.TB_1) player.profit_lottery19 = temp[0] player.headtail19 = temp[1] player.profit_this_round = player.profit_lottery19 if player.participant.task_rounds['L19'] == 54: return player.final_payoff() class Lottery20(Page): form_model = "player" form_fields = ["lottery_choice20"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L20'] def vars_for_template(player): return dict( l1a=C.VA_2 - C.TA_2, l1b=0, l2a=C.VA_2 - C.TB_2, l2b=C.VB_2 - C.TB_2, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice20, C.VA_2, C.VB_2, C.TA_2, C.TB_2) player.profit_lottery20 = temp[0] player.headtail20 = temp[1] player.profit_this_round = player.profit_lottery20 if player.participant.task_rounds['L20'] == 54: return player.final_payoff() class Lottery21(Page): form_model = "player" form_fields = ["lottery_choice21"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L21'] def vars_for_template(player): return dict( l1a=C.VA_3 - C.TA_3, l1b=0, l2a=C.VA_3 - C.TB_3, l2b=C.VB_3 - C.TB_3, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice21, C.VA_3, C.VB_3, C.TA_3, C.TB_3) player.profit_lottery21 = temp[0] player.headtail21 = temp[1] player.profit_this_round = player.profit_lottery21 if player.participant.task_rounds['L21'] == 54: return player.final_payoff() class Lottery22(Page): form_model = "player" form_fields = ["lottery_choice22"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L22'] def vars_for_template(player): return dict( l1a=C.VA_4 - C.TA_4, l1b=0, l2a=C.VA_4 - C.TB_4, l2b=C.VB_4 - C.TB_4, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice22, C.VA_4, C.VB_4, C.TA_4, C.TB_4) player.profit_lottery22 = temp[0] player.headtail22 = temp[1] player.profit_this_round = player.profit_lottery22 if player.participant.task_rounds['L22'] == 54: return player.final_payoff() class Lottery23(Page): form_model = "player" form_fields = ["lottery_choice23"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L23'] def vars_for_template(player): return dict( l1a=C.VA_5 - C.TA_5, l1b=0, l2a=C.VA_5 - C.TB_5, l2b=C.VB_5 - C.TB_5, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice23, C.VA_5, C.VB_5, C.TA_5, C.TB_5) player.profit_lottery23 = temp[0] player.headtail23 = temp[1] player.profit_this_round = player.profit_lottery23 if player.participant.task_rounds['L23'] == 54: return player.final_payoff() class Lottery24(Page): form_model = "player" form_fields = ["lottery_choice24"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L24'] def vars_for_template(player): return dict( l1a=C.VA_6 - C.TA_6, l1b=0, l2a=C.VA_6 - C.TB_6, l2b=C.VB_6 - C.TB_6, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice24, C.VA_6, C.VB_6, C.TA_6, C.TB_6) player.profit_lottery24 = temp[0] player.headtail24 = temp[1] player.profit_this_round = player.profit_lottery24 if player.participant.task_rounds['L24'] == 54: return player.final_payoff() class Lottery25(Page): form_model = "player" form_fields = ["lottery_choice25"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L25'] def vars_for_template(player): return dict( l1a=C.VA_7 - C.TA_7, l1b=0, l2a=C.VA_7 - C.TB_7, l2b=C.VB_7 - C.TB_7, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice25, C.VA_7, C.VB_7, C.TA_7, C.TB_7) player.profit_lottery25 = temp[0] player.headtail25 = temp[1] player.profit_this_round = player.profit_lottery25 if player.participant.task_rounds['L25'] == 54: return player.final_payoff() class Lottery26(Page): form_model = "player" form_fields = ["lottery_choice26"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L26'] def vars_for_template(player): return dict( l1a=C.VA_8 - C.TA_8, l1b=0, l2a=C.VA_8 - C.TB_8, l2b=C.VB_8 - C.TB_8, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice26, C.VA_8, C.VB_8, C.TA_8, C.TB_8) player.profit_lottery26 = temp[0] player.headtail26 = temp[1] player.profit_this_round = player.profit_lottery26 if player.participant.task_rounds['L26'] == 54: return player.final_payoff() class Lottery27(Page): form_model = "player" form_fields = ["lottery_choice27"] @staticmethod def is_displayed(player): return player.round_number == player.participant.task_rounds['L27'] def vars_for_template(player): return dict( l1a=C.VA_9 - C.TA_9, l1b=0, l2a=C.VA_9 - C.TB_9, l2b=C.VB_9 - C.TB_9, rn=player.round_number - 27 ) def before_next_page(player, timeout_happened): temp = lottery_1(player.lottery_choice27, C.VA_9, C.VB_9, C.TA_9, C.TB_9) player.profit_lottery27 = temp[0] player.headtail27 = temp[1] player.profit_this_round = player.profit_lottery27 if player.participant.task_rounds['L27'] == 54: return player.final_payoff() class Results(Page): form_model = "player" def is_displayed(player: Player): return player.round_number == 54 @staticmethod def vars_for_template(player): statec = player.payment_round payrange = player.participant.payoff w = -10 wa = -10 wb = -10 va = -10 vb = -10 ta = -10 tb = -10 vaa = -10 vab = -10 vba = -10 vbb = -10 taa = -10 tab = -10 tba = -10 tbb = -10 l1a = -10 l1b = 0 l2a = -10 l2b = -10 l3a = -10 l3b = -10 l4a = -10 l4b = -10 lottery = 'X' worker1 = 'Ann' worker2 = 'Bob' coin = 'the coin came up Head' if statec == player.participant.task_rounds['L1']: l1a=C.VA_1 - C.TA_1 l2a=C.VA_1 - C.TB_1 l2b=C.VB_1 - C.TB_1 if player.in_round(player.participant.task_rounds['L1']).lottery_choice1 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L1']).lottery_choice1 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L1']).headtail1 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L2']: l1a=C.VA_2 - C.TA_2 l2a=C.VA_2 - C.TB_2 l2b=C.VB_2 - C.TB_2 if player.in_round(player.participant.task_rounds['L2']).lottery_choice2 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L2']).lottery_choice2 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L2']).headtail2 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L3']: l1a = C.VA_3 - C.TA_3 l2a = C.VA_3 - C.TB_3 l2b = C.VB_3 - C.TB_3 if player.in_round(player.participant.task_rounds['L3']).lottery_choice3 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L3']).lottery_choice3 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L3']).headtail3 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L4']: l1a = C.VA_4 - C.TA_4 l2a = C.VA_4 - C.TB_4 l2b = C.VB_4 - C.TB_4 if player.in_round(player.participant.task_rounds['L4']).lottery_choice4 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L4']).lottery_choice4 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L4']).headtail4 == 1: 'the coin came up Tail' if statec == player.participant.task_rounds['L5']: l1a = C.VA_5 - C.TA_5 l2a = C.VA_5 - C.TB_5 l2b = C.VB_5 - C.TB_5 if player.in_round(player.participant.task_rounds['L5']).lottery_choice5 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L5']).lottery_choice5 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L5']).headtail5 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L6']: l1a = C.VA_6 - C.TA_6 l2a = C.VA_6 - C.TB_6 l2b = C.VB_6 - C.TB_6 if player.in_round(player.participant.task_rounds['L6']).lottery_choice6 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L6']).lottery_choice6 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L6']).headtail6 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L7']: l1a = C.VA_7 - C.TA_7 l2a = C.VA_7 - C.TB_7 l2b = C.VB_7 - C.TB_7 if player.in_round(player.participant.task_rounds['L7']).lottery_choice7 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L7']).lottery_choice7 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L7']).headtail7 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L8']: l1a = C.VA_8 - C.TA_8 l2a = C.VA_8 - C.TB_8 l2b = C.VB_8 - C.TB_8 if player.in_round(player.participant.task_rounds['L8']).lottery_choice8 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L8']).lottery_choice8 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L8']).headtail8 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L9']: l1a = C.VA_9 - C.TA_9 l2a = C.VA_9 - C.TB_9 l2b = C.VB_9 - C.TB_9 if player.in_round(player.participant.task_rounds['L9']).lottery_choice9 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L9']).lottery_choice9 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L9']).headtail9 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L19']: l1a=C.VA_1 - C.TA_1 l2a=C.VA_1 - C.TB_1 l2b=C.VB_1 - C.TB_1 if player.in_round(player.participant.task_rounds['L19']).lottery_choice19 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L19']).lottery_choice19 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L19']).headtail19 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L19']).headtail19 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L20']: l1a=C.VA_2 - C.TA_2 l2a=C.VA_2 - C.TB_2 l2b=C.VB_2 - C.TB_2 if player.in_round(player.participant.task_rounds['L20']).lottery_choice20 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L20']).lottery_choice20 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L20']).headtail20 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L20']).headtail20 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L21']: l1a = C.VA_3 - C.TA_3 l2a = C.VA_3 - C.TB_3 l2b = C.VB_3 - C.TB_3 if player.in_round(player.participant.task_rounds['L21']).lottery_choice21 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L21']).lottery_choice21 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L21']).headtail21 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L21']).headtail21 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L22']: l1a = C.VA_4 - C.TA_4 l2a = C.VA_4 - C.TB_4 l2b = C.VB_4 - C.TB_4 if player.in_round(player.participant.task_rounds['L22']).lottery_choice22 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L22']).lottery_choice22 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L22']).headtail22 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L22']).headtail22 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L23']: l1a = C.VA_5 - C.TA_5 l2a = C.VA_5 - C.TB_5 l2b = C.VB_5 - C.TB_5 if player.in_round(player.participant.task_rounds['L23']).lottery_choice23 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L23']).lottery_choice23 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L23']).headtail23 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L23']).headtail23 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L24']: l1a = C.VA_6 - C.TA_6 l2a = C.VA_6 - C.TB_6 l2b = C.VB_6 - C.TB_6 if player.in_round(player.participant.task_rounds['L24']).lottery_choice24 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L24']).lottery_choice24 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L24']).headtail24 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L24']).headtail24 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L25']: l1a = C.VA_7 - C.TA_7 l2a = C.VA_7 - C.TB_7 l2b = C.VB_7 - C.TB_7 if player.in_round(player.participant.task_rounds['L25']).lottery_choice25 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L25']).lottery_choice25 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L25']).headtail25 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L25']).headtail25 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L26']: l1a = C.VA_8 - C.TA_8 l2a = C.VA_8 - C.TB_8 l2b = C.VB_8 - C.TB_8 if player.in_round(player.participant.task_rounds['L26']).lottery_choice26 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L26']).lottery_choice26 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L26']).headtail26 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L26']).headtail26 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L27']: l1a = C.VA_9 - C.TA_9 l2a = C.VA_9 - C.TB_9 l2b = C.VB_9 - C.TB_9 if player.in_round(player.participant.task_rounds['L27']).lottery_choice27 == True: lottery = 'A' elif player.in_round(player.participant.task_rounds['L27']).lottery_choice27 == False: lottery = 'B' if player.in_round(player.participant.task_rounds['L27']).headtail27 == 0: coin = 'the die came up 1, the coin came up Head' elif player.in_round(player.participant.task_rounds['L27']).headtail27 == 1: coin = 'the die came up 3, the coin came up Head' if statec == player.participant.task_rounds['L10']: l1a = C.VAA_1 - C.TAA_1 l1b = C.VAB_1 - C.TAB_1 l2a = C.VAA_1 - C.TAA_1 + C.VBB_1 - C.TBB_1 l2b = C.VAB_1 - C.TBB_1 l3a = C.VAA_1 - C.TBA_1 l3b = C.VAB_1 - C.TAB_1 + C.VBA_1 - C.TBA_1 l4a = C.VAA_1 - C.TBA_1 + C.VBB_1 - C.TBB_1 l4b = C.VAB_1 - C.TBB_1 + C.VBA_1 - C.TBA_1 if player.in_round(player.participant.task_rounds['L10']).lottery_choice10 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L10']).lottery_choice10 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L10']).lottery_choice10 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L10']).lottery_choice10 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L10']).headtail10 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L11']: l1a = C.VAA_2 - C.TAA_2 l1b = C.VAB_2 - C.TAB_2 l2a = C.VAA_2 - C.TAA_2 + C.VBB_2 - C.TBB_2 l2b = C.VAB_2 - C.TBB_2 l3a = C.VAA_2 - C.TBA_2 l3b = C.VAB_2 - C.TAB_2 + C.VBA_2 - C.TBA_2 l4a = C.VAA_2 - C.TBA_2 + C.VBB_2 - C.TBB_2 l4b = C.VAB_2 - C.TBB_2 + C.VBA_2 - C.TBA_2 if player.in_round(player.participant.task_rounds['L11']).lottery_choice11 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L11']).lottery_choice11 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L11']).lottery_choice11 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L11']).lottery_choice11 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L11']).headtail11 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L12']: l1a = C.VAA_3 - C.TAA_3 l1b = C.VAB_3 - C.TAB_3 l2a = C.VAA_3 - C.TAA_3 + C.VBB_3 - C.TBB_3 l2b = C.VAB_3 - C.TBB_3 l3a = C.VAA_3 - C.TBA_3 l3b = C.VAB_3 - C.TAB_3 + C.VBA_3 - C.TBA_3 l4a = C.VAA_3 - C.TBA_3 + C.VBB_3 - C.TBB_3 l4b = C.VAB_3 - C.TBB_3 + C.VBA_3 - C.TBA_3 if player.in_round(player.participant.task_rounds['L12']).lottery_choice12 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L12']).lottery_choice12 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L12']).lottery_choice12 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L12']).lottery_choice12 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L12']).headtail12 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L13']: l1a = C.VAA_4 - C.TAA_4 l1b = C.VAB_4 - C.TAB_4 l2a = C.VAA_4 - C.TAA_4 + C.VBB_4 - C.TBB_4 l2b = C.VAB_4 - C.TBB_4 l3a = C.VAA_4 - C.TBA_4 l3b = C.VAB_4 - C.TAB_4 + C.VBA_4 - C.TBA_4 l4a = C.VAA_4 - C.TBA_4 + C.VBB_4 - C.TBB_4 l4b = C.VAB_4 - C.TBB_4 + C.VBA_4 - C.TBA_4 if player.in_round(player.participant.task_rounds['L13']).lottery_choice13 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L13']).lottery_choice13 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L13']).lottery_choice13 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L13']).lottery_choice13 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L13']).headtail13 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L14']: l1a = C.VAA_5 - C.TAA_5 l1b = C.VAB_5 - C.TAB_5 l2a = C.VAA_5 - C.TAA_5 + C.VBB_5 - C.TBB_5 l2b = C.VAB_5 - C.TBB_5 l3a = C.VAA_5 - C.TBA_5 l3b = C.VAB_5 - C.TAB_5 + C.VBA_5 - C.TBA_5 l4a = C.VAA_5 - C.TBA_5 + C.VBB_5 - C.TBB_5 l4b = C.VAB_5 - C.TBB_5 + C.VBA_5 - C.TBA_5 if player.in_round(player.participant.task_rounds['L14']).lottery_choice14 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L14']).lottery_choice14 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L14']).lottery_choice14 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L14']).lottery_choice14 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L14']).headtail14 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L15']: l1a = C.VAA_6 - C.TAA_6 l1b = C.VAB_6 - C.TAB_6 l2a = C.VAA_6 - C.TAA_6 + C.VBB_6 - C.TBB_6 l2b = C.VAB_6 - C.TBB_6 l3a = C.VAA_6 - C.TBA_6 l3b = C.VAB_6 - C.TAB_6 + C.VBA_6 - C.TBA_6 l4a = C.VAA_6 - C.TBA_6 + C.VBB_6 - C.TBB_6 l4b = C.VAB_6 - C.TBB_6 + C.VBA_6 - C.TBA_6 if player.in_round(player.participant.task_rounds['L15']).lottery_choice15 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L15']).lottery_choice15 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L15']).lottery_choice15 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L15']).lottery_choice15 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L15']).headtail15 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L16']: l1a = C.VAA_7 - C.TAA_7 l1b = C.VAB_7 - C.TAB_7 l2a = C.VAA_7 - C.TAA_7 + C.VBB_7 - C.TBB_7 l2b = C.VAB_7 - C.TBB_7 l3a = C.VAA_7 - C.TBA_7 l3b = C.VAB_7 - C.TAB_7 + C.VBA_7 - C.TBA_7 l4a = C.VAA_7 - C.TBA_7 + C.VBB_7 - C.TBB_7 l4b = C.VAB_7 - C.TBB_7 + C.VBA_7 - C.TBA_7 if player.in_round(player.participant.task_rounds['L16']).lottery_choice16 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L16']).lottery_choice16 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L16']).lottery_choice16 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L16']).lottery_choice16 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L16']).headtail16 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L17']: l1a = C.VAA_8 - C.TAA_8 l1b = C.VAB_8 - C.TAB_8 l2a = C.VAA_8 - C.TAA_8 + C.VBB_8 - C.TBB_8 l2b = C.VAB_8 - C.TBB_8 l3a = C.VAA_8 - C.TBA_8 l3b = C.VAB_8 - C.TAB_8 + C.VBA_8 - C.TBA_8 l4a = C.VAA_8 - C.TBA_8 + C.VBB_8 - C.TBB_8 l4b = C.VAB_8 - C.TBB_8 + C.VBA_8 - C.TBA_8 if player.in_round(player.participant.task_rounds['L17']).lottery_choice17 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L17']).lottery_choice17 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L17']).lottery_choice17 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L17']).lottery_choice17 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L17']).headtail17 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['L18']: l1a = C.VAA_9 - C.TAA_9 l1b = C.VAB_9 - C.TAB_9 l2a = C.VAA_9 - C.TAA_9 + C.VBB_9 - C.TBB_9 l2b = C.VAB_9 - C.TBB_9 l3a = C.VAA_9 - C.TBA_9 l3b = C.VAB_9 - C.TAB_9 + C.VBA_9 - C.TBA_9 l4a = C.VAA_9 - C.TBA_9 + C.VBB_9 - C.TBB_9 l4b = C.VAB_9 - C.TBB_9 + C.VBA_9 - C.TBA_9 if player.in_round(player.participant.task_rounds['L18']).lottery_choice18 == 1: lottery = 'A' elif player.in_round(player.participant.task_rounds['L18']).lottery_choice18 == 2: lottery = 'B' elif player.in_round(player.participant.task_rounds['L18']).lottery_choice18 == 3: lottery = 'C' elif player.in_round(player.participant.task_rounds['L18']).lottery_choice18 == 4: lottery = 'D' if player.in_round(player.participant.task_rounds['L18']).headtail18 == 1: coin = 'the coin came up Tail' if statec == player.participant.task_rounds['R1']: w = player.in_round(player.participant.task_rounds['R1']).w_1 va = C.VA_1 vb = C.VB_1 ta = C.TA_1 tb = C.TB_1 if player.in_round(player.participant.task_rounds['R1']).worker_r1 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R2']: w = player.in_round(player.participant.task_rounds['R2']).w_2 va = C.VA_2 vb = C.VB_2 ta = C.TA_2 tb = C.TB_2 if player.in_round(player.participant.task_rounds['R2']).worker_r2 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R3']: w = player.in_round(player.participant.task_rounds['R3']).w_3 va = C.VA_3 vb = C.VB_3 ta = C.TA_3 tb = C.TB_3 if player.in_round(player.participant.task_rounds['R3']).worker_r3 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R4']: w = player.in_round(player.participant.task_rounds['R4']).w_4 va = C.VA_4 vb = C.VB_4 ta = C.TA_4 tb = C.TB_4 if player.in_round(player.participant.task_rounds['R4']).worker_r4 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R5']: w = player.in_round(player.participant.task_rounds['R5']).w_5 va = C.VA_5 vb = C.VB_5 ta = C.TA_5 tb = C.TB_5 if player.in_round(player.participant.task_rounds['R5']).worker_r5 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R6']: w = player.in_round(player.participant.task_rounds['R6']).w_6 va = C.VA_6 vb = C.VB_6 ta = C.TA_6 tb = C.TB_6 if player.in_round(player.participant.task_rounds['R6']).worker_r6 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R7']: w = player.in_round(player.participant.task_rounds['R7']).w_7 va = C.VA_7 vb = C.VB_7 ta = C.TA_7 tb = C.TB_7 if player.in_round(player.participant.task_rounds['R7']).worker_r7 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R8']: w = player.in_round(player.participant.task_rounds['R8']).w_8 va = C.VA_8 vb = C.VB_8 ta = C.TA_8 tb = C.TB_8 if player.in_round(player.participant.task_rounds['R8']).worker_r8 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R9']: w = player.in_round(player.participant.task_rounds['R9']).w_9 va = C.VA_9 vb = C.VB_9 ta = C.TA_9 tb = C.TB_9 if player.in_round(player.participant.task_rounds['R9']).worker_r9 == 1: worker1 = 'Bob' elif statec == player.participant.task_rounds['R19']: w = player.in_round(player.participant.task_rounds['R19']).wr_1 va = C.VA_1 vb = C.VB_1 ta = C.TA_1 tb = C.TB_1 if player.in_round(player.participant.task_rounds['R19']).worker3_r1 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R19']).worker3_r1 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R19']).worker3_r1 == 1) and (player.in_round(player.participant.task_rounds['R19']).numapply_r1 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R19']).worker3_r1 == 1) and (player.in_round(player.participant.task_rounds['R19']).numapply_r1 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R20']: w = player.in_round(player.participant.task_rounds['R20']).wr_2 va = C.VA_2 vb = C.VB_2 ta = C.TA_2 tb = C.TB_2 if player.in_round(player.participant.task_rounds['R20']).worker3_r2 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R20']).worker3_r2 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R20']).worker3_r2 == 1) and (player.in_round(player.participant.task_rounds['R20']).numapply_r2 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R20']).worker3_r2 == 1) and (player.in_round(player.participant.task_rounds['R20']).numapply_r2 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R21']: w = player.in_round(player.participant.task_rounds['R21']).wr_3 va = C.VA_3 vb = C.VB_3 ta = C.TA_3 tb = C.TB_3 if player.in_round(player.participant.task_rounds['R21']).worker3_r3 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R21']).worker3_r3 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R21']).worker3_r3 == 1) and (player.in_round(player.participant.task_rounds['R21']).numapply_r3 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R21']).worker3_r3 == 1) and (player.in_round(player.participant.task_rounds['R21']).numapply_r3 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R22']: w = player.in_round(player.participant.task_rounds['R22']).wr_4 va = C.VA_4 vb = C.VB_4 ta = C.TA_4 tb = C.TB_4 if player.in_round(player.participant.task_rounds['R22']).worker3_r4 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R22']).worker3_r4 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R22']).worker3_r4 == 1) and (player.in_round(player.participant.task_rounds['R22']).numapply_r4 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R22']).worker3_r4 == 1) and (player.in_round(player.participant.task_rounds['R22']).numapply_r4 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R23']: w = player.in_round(player.participant.task_rounds['R23']).wr_5 va = C.VA_5 vb = C.VB_5 ta = C.TA_5 tb = C.TB_5 if player.in_round(player.participant.task_rounds['R23']).worker3_r5 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R23']).worker3_r5 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R23']).worker3_r5 == 1) and (player.in_round(player.participant.task_rounds['R23']).numapply_r5 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R23']).worker3_r5 == 1) and (player.in_round(player.participant.task_rounds['R23']).numapply_r5 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R24']: w = player.in_round(player.participant.task_rounds['R24']).wr_6 va = C.VA_6 vb = C.VB_6 ta = C.TA_6 tb = C.TB_6 if player.in_round(player.participant.task_rounds['R24']).worker3_r6 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R24']).worker3_r6 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R24']).worker3_r6 == 1) and (player.in_round(player.participant.task_rounds['R24']).numapply_r6 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R24']).worker3_r6 == 1) and (player.in_round(player.participant.task_rounds['R24']).numapply_r6 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R25']: w = player.in_round(player.participant.task_rounds['R25']).wr_7 va = C.VA_7 vb = C.VB_7 ta = C.TA_7 tb = C.TB_7 if player.in_round(player.participant.task_rounds['R25']).worker3_r7 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R25']).worker3_r7 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R25']).worker3_r7 == 1) and (player.in_round(player.participant.task_rounds['R25']).numapply_r7 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R25']).worker3_r7 == 1) and (player.in_round(player.participant.task_rounds['R25']).numapply_r7 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R26']: w = player.in_round(player.participant.task_rounds['R26']).wr_8 va = C.VA_8 vb = C.VB_8 ta = C.TA_8 tb = C.TB_8 if player.in_round(player.participant.task_rounds['R26']).worker3_r8 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R26']).worker3_r8 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R26']).worker3_r8 == 1) and (player.in_round(player.participant.task_rounds['R26']).numapply_r8 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R26']).worker3_r8 == 1) and (player.in_round(player.participant.task_rounds['R26']).numapply_r8 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R27']: w = player.in_round(player.participant.task_rounds['R27']).wr_9 va = C.VA_9 vb = C.VB_9 ta = C.TA_9 tb = C.TB_9 if player.in_round(player.participant.task_rounds['R27']).worker3_r9 == 0: worker1 = 'Only Ann applied for the job' elif player.in_round(player.participant.task_rounds['R27']).worker3_r9 == 2: worker1 = 'Only Bob applied for the job' elif ((player.in_round(player.participant.task_rounds['R27']).worker3_r9 == 1) and (player.in_round(player.participant.task_rounds['R27']).numapply_r9 == 0)): worker1 = 'Both applied for the job and Ann got the job' elif ((player.in_round(player.participant.task_rounds['R27']).worker3_r9 == 1) and (player.in_round(player.participant.task_rounds['R27']).numapply_r9 == 1)): worker1 = 'Both applied for the job and Bob got the job' elif statec == player.participant.task_rounds['R10']: wa = player.in_round(player.participant.task_rounds['R10']).wa_1 wb = player.in_round(player.participant.task_rounds['R10']).wb_1 vaa = C.VAA_1 vab = C.VAB_1 vba = C.VBA_1 vbb = C.VBB_1 taa = C.TAA_1 tab = C.TAB_1 tba = C.TBA_1 tbb = C.TBB_1 if player.in_round(player.participant.task_rounds['R10']).worker2_r1 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R11']: wa = player.in_round(player.participant.task_rounds['R11']).wa_2 wb = player.in_round(player.participant.task_rounds['R11']).wb_2 vaa = C.VAA_2 vab = C.VAB_2 vba = C.VBA_2 vbb = C.VBB_2 taa = C.TAA_2 tab = C.TAB_2 tba = C.TBA_2 tbb = C.TBB_2 if player.in_round(player.participant.task_rounds['R11']).worker2_r2 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R12']: wa = player.in_round(player.participant.task_rounds['R12']).wa_3 wb = player.in_round(player.participant.task_rounds['R12']).wb_3 vaa = C.VAA_3 vab = C.VAB_3 vba = C.VBA_3 vbb = C.VBB_3 taa = C.TAA_3 tab = C.TAB_3 tba = C.TBA_3 tbb = C.TBB_3 if player.in_round(player.participant.task_rounds['R12']).worker2_r3 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R13']: wa = player.in_round(player.participant.task_rounds['R13']).wa_4 wb = player.in_round(player.participant.task_rounds['R13']).wb_4 vaa = C.VAA_4 vab = C.VAB_4 vba = C.VBA_4 vbb = C.VBB_4 taa = C.TAA_4 tab = C.TAB_4 tba = C.TBA_4 tbb = C.TBB_4 if player.in_round(player.participant.task_rounds['R13']).worker2_r4 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R14']: wa = player.in_round(player.participant.task_rounds['R14']).wa_5 wb = player.in_round(player.participant.task_rounds['R14']).wb_5 vaa = C.VAA_5 vab = C.VAB_5 vba = C.VBA_5 vbb = C.VBB_5 taa = C.TAA_5 tab = C.TAB_5 tba = C.TBA_5 tbb = C.TBB_5 if player.in_round(player.participant.task_rounds['R14']).worker2_r5 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R15']: wa = player.in_round(player.participant.task_rounds['R15']).wa_6 wb = player.in_round(player.participant.task_rounds['R15']).wb_6 vaa = C.VAA_6 vab = C.VAB_6 vba = C.VBA_6 vbb = C.VBB_6 taa = C.TAA_6 tab = C.TAB_6 tba = C.TBA_6 tbb = C.TBB_6 if player.in_round(player.participant.task_rounds['R15']).worker2_r6 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R16']: wa = player.in_round(player.participant.task_rounds['R16']).wa_7 wb = player.in_round(player.participant.task_rounds['R16']).wb_7 vaa = C.VAA_7 vab = C.VAB_7 vba = C.VBA_7 vbb = C.VBB_7 taa = C.TAA_7 tab = C.TAB_7 tba = C.TBA_7 tbb = C.TBB_7 if player.in_round(player.participant.task_rounds['R16']).worker2_r7 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R17']: wa = player.in_round(player.participant.task_rounds['R17']).wa_8 wb = player.in_round(player.participant.task_rounds['R17']).wb_8 vaa = C.VAA_8 vab = C.VAB_8 vba = C.VBA_8 vbb = C.VBB_8 taa = C.TAA_8 tab = C.TAB_8 tba = C.TBA_8 tbb = C.TBB_8 if player.in_round(player.participant.task_rounds['R17']).worker2_r8 == 1: worker1 = 'Bob' worker2 = 'Ann' elif statec == player.participant.task_rounds['R18']: wa = player.in_round(player.participant.task_rounds['R18']).wa_9 wb = player.in_round(player.participant.task_rounds['R18']).wb_9 vaa = C.VAA_9 vab = C.VAB_9 vba = C.VBA_9 vbb = C.VBB_9 taa = C.TAA_9 tab = C.TAB_9 tba = C.TBA_9 tbb = C.TBB_9 if player.in_round(player.participant.task_rounds['R18']).worker2_r9 == 1: worker1 = 'Bob' worker2 = 'Ann' return dict( payrange=payrange >= 0, state=player.payment_round < 28, lottery_num=player.payment_round - 27, w=w, wa=wa, wb=wb, va=va, vb=vb, ta=ta, tb=tb, vaa=vaa, vab=vab, vba=vba, vbb=vbb, taa=taa, tab=tab, tba=tba, tbb=tbb, l1a=l1a, l1b=l1b, l2a=l2a, l2b=l2b, l3a=l3a, l3b=l3b, l4a=l4a, l4b=l4b, lottery=lottery, statec=statec, state1=(statec == player.participant.task_rounds['R1']) | (statec == player.participant.task_rounds['R2']) | (statec == player.participant.task_rounds['R3']) | (statec == player.participant.task_rounds['R4']) | (statec == player.participant.task_rounds['R5']) | (statec == player.participant.task_rounds['R6']) | (statec == player.participant.task_rounds['R7']) | (statec == player.participant.task_rounds['R8']) | (statec == player.participant.task_rounds['R9']), state2=(statec == player.participant.task_rounds['R10']) | (statec == player.participant.task_rounds['R11']) | (statec == player.participant.task_rounds['R12']) | (statec == player.participant.task_rounds['R13']) | (statec == player.participant.task_rounds['R14']) | (statec == player.participant.task_rounds['R15']) | (statec == player.participant.task_rounds['R16']) | (statec == player.participant.task_rounds['R17']) | (statec == player.participant.task_rounds['R18']), state3=(statec == player.participant.task_rounds['R19']) | (statec == player.participant.task_rounds['R20']) | (statec == player.participant.task_rounds['R21']) | (statec == player.participant.task_rounds['R22']) | (statec == player.participant.task_rounds['R23']) | (statec == player.participant.task_rounds['R24']) | (statec == player.participant.task_rounds['R25']) | (statec == player.participant.task_rounds['R26']) | (statec == player.participant.task_rounds['R27']), state4=(statec == player.participant.task_rounds['L1']) | (statec == player.participant.task_rounds['L2']) | (statec == player.participant.task_rounds['L3']) | (statec == player.participant.task_rounds['L4']) | (statec == player.participant.task_rounds['L5']) | (statec == player.participant.task_rounds['L6']) | (statec == player.participant.task_rounds['L7']) | (statec == player.participant.task_rounds['L8']) | (statec == player.participant.task_rounds['L9']), state5=(statec == player.participant.task_rounds['L10']) | (statec == player.participant.task_rounds['L11']) | (statec == player.participant.task_rounds['L12']) | (statec == player.participant.task_rounds['L13']) | (statec == player.participant.task_rounds['L14']) | (statec == player.participant.task_rounds['L15']) | (statec == player.participant.task_rounds['L16']) | (statec == player.participant.task_rounds['L17']) | (statec == player.participant.task_rounds['L18']), state6=(statec == player.participant.task_rounds['L19']) | (statec == player.participant.task_rounds['L20']) | (statec == player.participant.task_rounds['L21']) | (statec == player.participant.task_rounds['L22']) | (statec == player.participant.task_rounds['L23']) | (statec == player.participant.task_rounds['L24']) | (statec == player.participant.task_rounds['L25']) | (statec == player.participant.task_rounds['L26']) | (statec == player.participant.task_rounds['L27']), worker1=worker1, worker2=worker2, coin=coin ) # need to add more... page_sequence = [Round1_1, Round2, Round3, Round4, Round5, Round6, Round7, Round8, Round9, Round10_1, Round11, Round12, Round13, Round14, Round15, Round16, Round17, Round18, Round19, Round20, Round21, Round22, Round23, Round24, Round25, Round26, Round27, Lottery1, Lottery2, Lottery3, Lottery4, Lottery5, Lottery6, Lottery7, Lottery8, Lottery9, Lottery10, Lottery11, Lottery12, Lottery13, Lottery14, Lottery15, Lottery16, Lottery17, Lottery18, Lottery19, Lottery20, Lottery21, Lottery22, Lottery23, Lottery24, Lottery25, Lottery26, Lottery27, Results] def payoff_1(wage, reva, revb, mina, minb): x = random.randint(0, 1) if mina <= wage < minb: if x == 0: y = reva - wage else: y = 0 elif wage >= minb: if x == 0: y = reva - wage else: y = revb - wage else: y = 0 return y, x def payoff_2(wage1, wage2, reva1, reva2, revb1, revb2, mina1, mina2, minb1, minb2): x = random.randint(0, 1) if mina1 <= wage1 < minb1: if x == 0: y1 = reva1 - wage1 else: y1 = 0 elif minb1 <= wage1: if x == 0: y1 = reva1 - wage1 else: y1 = revb1 - wage1 else: y1 = 0 if mina2 <= wage2 < minb2: if x == 1: y2 = reva2 - wage2 else: y2 = 0 elif minb2 <= wage2: if x == 1: y2 = reva2 - wage2 else: y2 = revb2 - wage2 else: y2 = 0 return y1 + y2, x def payoff_3(wage, reva, revb, mina, minb): x = random.randint(0, 2) z = random.randint(0, 1) if mina <= wage < minb: if x == 0: y = reva - wage elif (x == 1) and (z == 0): y = reva - wage elif (x == 1) and (z == 1): y = 0 elif x == 2: y = 0 elif wage >= minb: if x == 0: y = reva - wage elif (x == 1) and (z == 0): y = reva - wage elif (x == 1) and (z == 1): y = revb - wage elif x == 2: y = revb - wage else: y = 0 return y, x, z def lottery_1(choice, reva, revb, mina, minb): x = random.randint(0, 1) if choice: if x == 0: return reva - mina, x else: return 0, x else: if x == 0: return reva - minb, x else: return revb - minb, x def lottery_2(choice, revAa, revAb, revBa, revBb, minAa, minAb, minBa, minBb): x = random.randint(0, 1) if choice == 1: if x == 0: return revAa - minAa, x else: return revAb - minAb, x elif choice == 2: if x == 0: return revAa - minAa + revBb - minBb, x else: return revAb - minBb, x elif choice == 3: if x == 0: return revAa - minBa, x else: return revAb - minAb + revBa - minBa, x elif choice == 4: if x == 0: return revAa - minBa + revBb - minBb, x else: return revAb - minBb + revBa - minBa, x