from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import random import datetime, json, time import math import numpy as np def choices(): choice00000 = (60, 15, 20, 30) return choice00000 # remove 45 seconds, keep 15, 20, 30, 60 def budget(): budget00000 = (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) return budget00000 def question(): #question_choice = 22 question_choice = random.randint(1, 34) return question_choice class instruction_choice(Page): form_model = 'player' form_fields = ['baseline'] def is_displayed(self): return self.round_number == 1 def vars_for_template(self): self.player.baseline = question() self.participant.vars['baseline'] = self.player.baseline return dict( baseline = self.participant.vars['baseline'] ) def js_vars(self): return { 'baseline': self.participant.vars['baseline'] } class survey1_15(Page): form_model = 'player' form_fields = ['choice6'] def is_displayed(self): return self.round_number == 1 def before_next_page(self): if self.player.choice6 == str(60): self.participant.vars['choice6'] = choices()[0] self.player.choice5 = str(60) self.player.choice4 = str(60) self.player.choice3 = str(60) self.player.choice2 = str(60) self.player.choice1 = str(60) if self.player.choice6 == str(15): self.participant.vars['choice6'] = choices()[1] self.player.choice7 = str(15) self.player.choice8 = str(15) self.player.choice9 = str(15) self.player.choice10 = str(15) self.player.choice11 = str(15) class blank1(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return self.round_number == 1 class survey1_14_16(Page): form_model = 'player' form_fields = ['choice5', 'choice7'] def is_displayed(self): return self.round_number == 1 def vars_for_template(self): return dict( choice6=self.participant.vars['choice6'] ) def js_vars(self): return { 'choice6': self.participant.vars['choice6'], } def before_next_page(self): if self.player.choice7 == str(60) and self.player.choice6 == str(60): self.participant.vars['choice5'] = choices()[0] self.participant.vars['choice7'] = choices()[0] if self.player.choice7 == str(15) and self.player.choice6 == str(60): self.participant.vars['choice5'] = choices()[0] self.participant.vars['choice7'] = choices()[1] self.player.choice8 = str(15) self.player.choice9 = str(15) self.player.choice10 = str(15) self.player.choice11 = str(15) if self.player.choice5 == str(15) and self.player.choice6 == str(15): self.participant.vars['choice5'] = choices()[1] self.participant.vars['choice7'] = choices()[1] if self.player.choice5 == str(60) and self.player.choice6 == str(15): self.participant.vars['choice5'] = choices()[0] self.participant.vars['choice7'] = choices()[1] self.player.choice4 = str(60) self.player.choice3 = str(60) self.player.choice2 = str(60) self.player.choice1 = str(60) class blank2(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice6 == str(60) and self.player.choice7 == str(60)) \ or (self.round_number == 1 and self.player.choice6 == str(15) and self.player.choice5 == str(15)) class survey1_13_17(Page): form_model = 'player' form_fields = ['choice4', 'choice8'] def is_displayed(self): return (self.round_number == 1 and self.player.choice6 == str(60) and self.player.choice7 == str(60)) \ or (self.round_number == 1 and self.player.choice6 == str(15) and self.player.choice5 == str(15)) def vars_for_template(self): return dict( choice5=self.participant.vars['choice5'], choice6=self.participant.vars['choice6'], choice7=self.participant.vars['choice7'], ) def js_vars(self): return { 'choice5': self.participant.vars['choice5'], 'choice6': self.participant.vars['choice6'], 'choice7': self.participant.vars['choice7'], } def before_next_page(self): if self.player.choice4 == str(60) and self.player.choice5 == str(15): self.participant.vars['choice4'] = choices()[0] self.participant.vars['choice8'] = choices()[1] self.player.choice3 = str(60) self.player.choice2 = str(60) self.player.choice1 = str(60) if self.player.choice4 == str(15) and self.player.choice5 == str(15): self.participant.vars['choice4'] = choices()[1] self.participant.vars['choice8'] = choices()[1] if self.player.choice8 == str(60) and self.player.choice7 == str(60): self.participant.vars['choice4'] = choices()[0] self.participant.vars['choice8'] = choices()[0] if self.player.choice7 == str(60) and self.player.choice8 == str(15): self.participant.vars['choice4'] = choices()[0] self.participant.vars['choice8'] = choices()[1] self.player.choice9 = str(15) self.player.choice10 = str(15) self.player.choice11 = str(15) class blank3(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice7 == str(60) and self.player.choice8 == str(60)) \ or (self.round_number == 1 and self.player.choice4 == str(15) and self.player.choice5 == str(15)) class survey1_12_18(Page): form_model = 'player' form_fields = ['choice3', 'choice9'] def is_displayed(self): return (self.round_number == 1 and self.player.choice7 == str(60) and self.player.choice8 == str(60)) \ or (self.round_number == 1 and self.player.choice4 == str(15) and self.player.choice5 == str(15)) def vars_for_template(self): return dict( choice4=self.participant.vars['choice4'], choice5=self.participant.vars['choice5'], choice7=self.participant.vars['choice7'], choice8=self.participant.vars['choice8'], ) def js_vars(self): return { 'choice4': self.participant.vars['choice4'], 'choice5': self.participant.vars['choice5'], 'choice7': self.participant.vars['choice7'], 'choice8': self.participant.vars['choice8'], } def before_next_page(self): if self.player.choice3 == str(60) and self.player.choice4 == str(15): self.participant.vars['choice3'] = choices()[0] self.participant.vars['choice9'] = choices()[1] self.player.choice2 = str(60) self.player.choice1 = str(60) if self.player.choice4 == str(15) and self.player.choice3 == str(15): self.participant.vars['choice3'] = choices()[1] self.participant.vars['choice9'] = choices()[1] if self.player.choice8 == str(60) and self.player.choice9 == str(60): self.participant.vars['choice3'] = choices()[0] self.participant.vars['choice9'] = choices()[0] if self.player.choice8 == str(60) and self.player.choice9 == str(15): self.participant.vars['choice3'] = choices()[0] self.participant.vars['choice9'] = choices()[1] self.player.choice10 = str(15) self.player.choice11 = str(15) class blank4(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice9 == str(60) and self.player.choice8 == str(60)) \ or (self.round_number == 1 and self.player.choice4 == str(15) and self.player.choice3 == str(15)) class survey1_11_19(Page): form_model = 'player' form_fields = ['choice2', 'choice10'] def is_displayed(self): return (self.round_number == 1 and self.player.choice9 == str(60) and self.player.choice8 == str(60)) \ or (self.round_number == 1 and self.player.choice4 == str(15) and self.player.choice3 == str(15)) def vars_for_template(self): return dict( choice3=self.participant.vars['choice3'], choice4=self.participant.vars['choice4'], choice8=self.participant.vars['choice8'], choice9=self.participant.vars['choice9'], ) def js_vars(self): return { 'choice3': self.participant.vars['choice3'], 'choice4': self.participant.vars['choice4'], 'choice8': self.participant.vars['choice8'], 'choice9': self.participant.vars['choice9'], } def before_next_page(self): if self.player.choice2 == str(60) and self.player.choice3 == str(15): self.participant.vars['choice2'] = choices()[0] self.participant.vars['choice10'] = choices()[1] self.player.choice1 = str(60) if self.player.choice2 == str(15) and self.player.choice3 == str(15): self.participant.vars['choice2'] = choices()[1] self.participant.vars['choice10'] = choices()[1] if self.player.choice10 == str(60) and self.player.choice9 == str(60): self.participant.vars['choice2'] = choices()[0] self.participant.vars['choice10'] = choices()[0] if self.player.choice9 == str(60) and self.player.choice10 == str(15): self.participant.vars['choice2'] = choices()[0] self.participant.vars['choice10'] = choices()[1] self.player.choice11 = str(15) class blank5(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice9 == str(60) and self.player.choice10 == str(60)) \ or (self.round_number == 1 and self.player.choice2 == str(15) and self.player.choice3 == str(15)) class survey1_10_20(Page): form_model = 'player' form_fields = ['choice1', 'choice11'] def is_displayed(self): return (self.round_number == 1 and self.player.choice9 == str(60) and self.player.choice10 == str(60)) \ or (self.round_number == 1 and self.player.choice2 == str(15) and self.player.choice3 == str(15)) def vars_for_template(self): return dict( choice2=self.participant.vars['choice2'], choice3=self.participant.vars['choice3'], choice9=self.participant.vars['choice9'], choice10=self.participant.vars['choice10'], ) def js_vars(self): return { 'choice3': self.participant.vars['choice3'], 'choice2': self.participant.vars['choice2'], 'choice10': self.participant.vars['choice10'], 'choice9': self.participant.vars['choice9'], } def before_next_page(self): if self.player.choice1 == str(60) and self.player.choice2 == str(15): self.participant.vars['choice1'] = choices()[0] self.participant.vars['choice11'] = choices()[1] if self.player.choice2 == str(15) and self.player.choice1 == str(15): self.participant.vars['choice1'] = choices()[1] self.participant.vars['choice11'] = choices()[1] if self.player.choice10 == str(60) and self.player.choice11 == str(60): self.participant.vars['choice1'] = choices()[0] self.participant.vars['choice11'] = choices()[0] if self.player.choice10 == str(60) and self.player.choice11 == str(15): self.participant.vars['choice1'] = choices()[0] self.participant.vars['choice11'] = choices()[1] class survey2_15(Page): form_model = 'player' form_fields = ['choice17'] def is_displayed(self): return self.round_number == 1 def before_next_page(self): if self.player.choice17 == str(60): self.participant.vars['choice17'] = choices()[0] self.player.choice16 = str(60) self.player.choice15 = str(60) self.player.choice14 = str(60) self.player.choice13 = str(60) self.player.choice12 = str(60) if self.player.choice17 == str(20): self.participant.vars['choice17'] = choices()[2] self.player.choice18 = str(20) self.player.choice19 = str(20) self.player.choice20 = str(20) self.player.choice21 = str(20) self.player.choice22 = str(20) class survey2_14_16(Page): form_model = 'player' form_fields = ['choice16', 'choice18'] def is_displayed(self): return self.round_number == 1 def vars_for_template(self): return dict( choice17=self.participant.vars['choice17'] ) def js_vars(self): return { 'choice17': self.participant.vars['choice17'], } def before_next_page(self): if self.player.choice18 == str(60) and self.player.choice17 == str(60): self.participant.vars['choice16'] = choices()[0] self.participant.vars['choice18'] = choices()[0] if self.player.choice18 == str(20) and self.player.choice17 == str(60): self.participant.vars['choice16'] = choices()[0] self.participant.vars['choice18'] = choices()[2] self.player.choice19 = str(20) self.player.choice20 = str(20) self.player.choice21 = str(20) self.player.choice22 = str(20) if self.player.choice16 == str(20) and self.player.choice17 == str(20): self.participant.vars['choice16'] = choices()[2] self.participant.vars['choice18'] = choices()[2] if self.player.choice16 == str(60) and self.player.choice17 == str(20): self.participant.vars['choice16'] = choices()[0] self.participant.vars['choice18'] = choices()[2] self.player.choice15 = str(60) self.player.choice14 = str(60) self.player.choice13 = str(60) self.player.choice12 = str(60) class blank6(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice17 == str(60) and self.player.choice18 == str(60)) \ or (self.round_number == 1 and self.player.choice17 == str(20) and self.player.choice16 == str(20)) class survey2_13_17(Page): form_model = 'player' form_fields = ['choice15', 'choice19'] def is_displayed(self): return (self.round_number == 1 and self.player.choice17 == str(60) and self.player.choice18 == str(60)) \ or (self.round_number == 1 and self.player.choice17 == str(20) and self.player.choice16 == str(20)) def vars_for_template(self): return dict( choice16=self.participant.vars['choice16'], choice17=self.participant.vars['choice17'], choice18=self.participant.vars['choice18'], ) def js_vars(self): return { 'choice16': self.participant.vars['choice16'], 'choice17': self.participant.vars['choice17'], 'choice18': self.participant.vars['choice18'], } def before_next_page(self): if self.player.choice15 == str(60) and self.player.choice16 == str(20): self.participant.vars['choice15'] = choices()[0] self.participant.vars['choice19'] = choices()[2] self.player.choice14 = str(60) self.player.choice13 = str(60) self.player.choice12 = str(60) if self.player.choice15 == str(20) and self.player.choice16 == str(20): self.participant.vars['choice15'] = choices()[2] self.participant.vars['choice19'] = choices()[2] if self.player.choice19 == str(60) and self.player.choice18 == str(60): self.participant.vars['choice15'] = choices()[0] self.participant.vars['choice19'] = choices()[0] if self.player.choice18 == str(60) and self.player.choice19 == str(20): self.participant.vars['choice15'] = choices()[0] self.participant.vars['choice19'] = choices()[2] self.player.choice20 = str(20) self.player.choice21 = str(20) self.player.choice22 = str(20) class blank7(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice18 == str(60) and self.player.choice19 == str(60)) \ or (self.round_number == 1 and self.player.choice15 == str(20) and self.player.choice16 == str(20)) class survey2_12_18(Page): form_model = 'player' form_fields = ['choice14', 'choice20'] def is_displayed(self): return (self.round_number == 1 and self.player.choice18 == str(60) and self.player.choice19 == str(60)) \ or (self.round_number == 1 and self.player.choice15 == str(20) and self.player.choice16 == str(20)) def vars_for_template(self): return dict( choice15=self.participant.vars['choice15'], choice16=self.participant.vars['choice16'], choice18=self.participant.vars['choice18'], choice19=self.participant.vars['choice19'], ) def js_vars(self): return { 'choice15': self.participant.vars['choice15'], 'choice16': self.participant.vars['choice16'], 'choice18': self.participant.vars['choice18'], 'choice19': self.participant.vars['choice19'], } def before_next_page(self): if self.player.choice14 == str(60) and self.player.choice15 == str(20): self.participant.vars['choice14'] = choices()[0] self.participant.vars['choice20'] = choices()[2] self.player.choice13 = str(60) self.player.choice12 = str(60) if self.player.choice15 == str(20) and self.player.choice14 == str(20): self.participant.vars['choice14'] = choices()[2] self.participant.vars['choice20'] = choices()[2] if self.player.choice19 == str(60) and self.player.choice20 == str(60): self.participant.vars['choice14'] = choices()[0] self.participant.vars['choice20'] = choices()[0] if self.player.choice19 == str(60) and self.player.choice20 == str(20): self.participant.vars['choice14'] = choices()[0] self.participant.vars['choice20'] = choices()[2] self.player.choice21 = str(20) self.player.choice22 = str(20) class blank8(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice20 == str(60) and self.player.choice19 == str(60)) \ or (self.round_number == 1 and self.player.choice15 == str(20) and self.player.choice14 == str(20)) class survey2_11_19(Page): form_model = 'player' form_fields = ['choice13', 'choice21'] def is_displayed(self): return (self.round_number == 1 and self.player.choice20 == str(60) and self.player.choice19 == str(60)) \ or (self.round_number == 1 and self.player.choice15 == str(20) and self.player.choice14 == str(20)) def vars_for_template(self): return dict( choice14=self.participant.vars['choice14'], choice15=self.participant.vars['choice15'], choice19=self.participant.vars['choice19'], choice20=self.participant.vars['choice20'], ) def js_vars(self): return { 'choice14': self.participant.vars['choice14'], 'choice15': self.participant.vars['choice15'], 'choice19': self.participant.vars['choice19'], 'choice20': self.participant.vars['choice20'], } def before_next_page(self): if self.player.choice13 == str(60) and self.player.choice14 == str(20): self.participant.vars['choice13'] = choices()[0] self.participant.vars['choice21'] = choices()[2] self.player.choice12 = str(60) if self.player.choice13 == str(20) and self.player.choice14 == str(20): self.participant.vars['choice13'] = choices()[2] self.participant.vars['choice21'] = choices()[2] if self.player.choice21 == str(60) and self.player.choice20 == str(60): self.participant.vars['choice13'] = choices()[0] self.participant.vars['choice21'] = choices()[0] if self.player.choice20 == str(60) and self.player.choice21 == str(20): self.participant.vars['choice13'] = choices()[0] self.participant.vars['choice21'] = choices()[2] self.player.choice22 = str(20) class blank9(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice20 == str(60) and self.player.choice21 == str(60)) \ or (self.round_number == 1 and self.player.choice13 == str(20) and self.player.choice14 == str(20)) class survey2_10_20(Page): form_model = 'player' form_fields = ['choice12', 'choice22'] def is_displayed(self): return (self.round_number == 1 and self.player.choice20 == str(60) and self.player.choice21 == str(60)) \ or (self.round_number == 1 and self.player.choice13 == str(20) and self.player.choice14 == str(20)) def vars_for_template(self): return dict( choice13=self.participant.vars['choice13'], choice14=self.participant.vars['choice14'], choice20=self.participant.vars['choice20'], choice21=self.participant.vars['choice21'], ) def js_vars(self): return { 'choice14': self.participant.vars['choice14'], 'choice13': self.participant.vars['choice13'], 'choice21': self.participant.vars['choice21'], 'choice20': self.participant.vars['choice20'], } def before_next_page(self): if self.player.choice12 == str(60) and self.player.choice13 == str(20): self.participant.vars['choice12'] = choices()[0] self.participant.vars['choice22'] = choices()[2] if self.player.choice13 == str(20) and self.player.choice12 == str(20): self.participant.vars['choice12'] = choices()[2] self.participant.vars['choice22'] = choices()[2] if self.player.choice21 == str(60) and self.player.choice22 == str(60): self.participant.vars['choice12'] = choices()[0] self.participant.vars['choice22'] = choices()[0] if self.player.choice21 == str(60) and self.player.choice22 == str(20): self.participant.vars['choice12'] = choices()[0] self.participant.vars['choice22'] = choices()[2] class survey3_15(Page): form_model = 'player' form_fields = ['choice28'] def is_displayed(self): return self.round_number == 1 def before_next_page(self): if self.player.choice28 == str(60): self.participant.vars['choice28'] = choices()[0] self.player.choice27 = str(60) self.player.choice26 = str(60) self.player.choice25 = str(60) self.player.choice24 = str(60) self.player.choice23 = str(60) if self.player.choice28 == str(30): self.participant.vars['choice28'] = choices()[3] self.player.choice29 = str(30) self.player.choice30 = str(30) self.player.choice31 = str(30) self.player.choice32 = str(30) self.player.choice33 = str(30) class survey3_14_16(Page): form_model = 'player' form_fields = ['choice27', 'choice29'] def is_displayed(self): return self.round_number == 1 def vars_for_template(self): return dict( choice28=self.participant.vars['choice28'] ) def js_vars(self): return { 'choice28': self.participant.vars['choice28'], } def before_next_page(self): if self.player.choice29 == str(60) and self.player.choice28 == str(60): self.participant.vars['choice27'] = choices()[0] self.participant.vars['choice29'] = choices()[0] if self.player.choice29 == str(30) and self.player.choice28 == str(60): self.participant.vars['choice27'] = choices()[0] self.participant.vars['choice29'] = choices()[3] self.player.choice30 = str(30) self.player.choice31 = str(30) self.player.choice32 = str(30) self.player.choice33 = str(30) if self.player.choice27 == str(30) and self.player.choice28 == str(30): self.participant.vars['choice27'] = choices()[3] self.participant.vars['choice29'] = choices()[3] if self.player.choice27 == str(60) and self.player.choice28 == str(30): self.participant.vars['choice27'] = choices()[0] self.participant.vars['choice29'] = choices()[3] self.player.choice26 = str(60) self.player.choice25 = str(60) self.player.choice24 = str(60) self.player.choice23 = str(60) class blank10(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice28 == str(60) and self.player.choice29 == str(60)) \ or (self.round_number == 1 and self.player.choice28 == str(30) and self.player.choice27 == str(30)) class survey3_13_17(Page): form_model = 'player' form_fields = ['choice26', 'choice30'] def is_displayed(self): return (self.round_number == 1 and self.player.choice28 == str(60) and self.player.choice29 == str(60)) \ or (self.round_number == 1 and self.player.choice28 == str(30) and self.player.choice27 == str(30)) def vars_for_template(self): return dict( choice27=self.participant.vars['choice27'], choice28=self.participant.vars['choice28'], choice29=self.participant.vars['choice29'], ) def js_vars(self): return { 'choice27': self.participant.vars['choice27'], 'choice28': self.participant.vars['choice28'], 'choice29': self.participant.vars['choice29'], } def before_next_page(self): if self.player.choice26 == str(60) and self.player.choice27 == str(30): self.participant.vars['choice26'] = choices()[0] self.participant.vars['choice30'] = choices()[3] self.player.choice25 = str(60) self.player.choice24 = str(60) self.player.choice23 = str(60) if self.player.choice26 == str(30) and self.player.choice27 == str(30): self.participant.vars['choice26'] = choices()[3] self.participant.vars['choice30'] = choices()[3] if self.player.choice30 == str(60) and self.player.choice29 == str(60): self.participant.vars['choice26'] = choices()[0] self.participant.vars['choice30'] = choices()[0] if self.player.choice29 == str(60) and self.player.choice30 == str(30): self.participant.vars['choice26'] = choices()[0] self.participant.vars['choice30'] = choices()[3] self.player.choice31 = str(30) self.player.choice32 = str(30) self.player.choice33 = str(30) class blank11(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice29 == str(60) and self.player.choice30 == str(60)) \ or (self.round_number == 1 and self.player.choice26 == str(30) and self.player.choice27 == str(30)) class survey3_12_18(Page): form_model = 'player' form_fields = ['choice25', 'choice31'] def is_displayed(self): return (self.round_number == 1 and self.player.choice29 == str(60) and self.player.choice30 == str(60)) \ or (self.round_number == 1 and self.player.choice26 == str(30) and self.player.choice27 == str(30)) def vars_for_template(self): return dict( choice26=self.participant.vars['choice26'], choice27=self.participant.vars['choice27'], choice29=self.participant.vars['choice29'], choice30=self.participant.vars['choice30'], ) def js_vars(self): return { 'choice26': self.participant.vars['choice26'], 'choice27': self.participant.vars['choice27'], 'choice29': self.participant.vars['choice29'], 'choice30': self.participant.vars['choice30'], } def before_next_page(self): if self.player.choice25 == str(60) and self.player.choice26 == str(30): self.participant.vars['choice25'] = choices()[0] self.participant.vars['choice31'] = choices()[3] self.player.choice24 = str(60) self.player.choice23 = str(60) if self.player.choice26 == str(30) and self.player.choice25 == str(30): self.participant.vars['choice25'] = choices()[3] self.participant.vars['choice31'] = choices()[3] if self.player.choice30 == str(60) and self.player.choice31 == str(60): self.participant.vars['choice25'] = choices()[0] self.participant.vars['choice31'] = choices()[0] if self.player.choice30 == str(60) and self.player.choice31 == str(30): self.participant.vars['choice25'] = choices()[0] self.participant.vars['choice31'] = choices()[3] self.player.choice32 = str(30) self.player.choice33 = str(30) class blank12(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice31 == str(60) and self.player.choice30 == str(60)) \ or (self.round_number == 1 and self.player.choice26 == str(30) and self.player.choice25 == str(30)) class survey3_11_19(Page): form_model = 'player' form_fields = ['choice24', 'choice32'] def is_displayed(self): return (self.round_number == 1 and self.player.choice31 == str(60) and self.player.choice30 == str(60)) \ or (self.round_number == 1 and self.player.choice26 == str(30) and self.player.choice25 == str(30)) def vars_for_template(self): return dict( choice25=self.participant.vars['choice25'], choice26=self.participant.vars['choice26'], choice30=self.participant.vars['choice30'], choice31=self.participant.vars['choice31'], ) def js_vars(self): return { 'choice25': self.participant.vars['choice25'], 'choice26': self.participant.vars['choice26'], 'choice30': self.participant.vars['choice30'], 'choice31': self.participant.vars['choice31'], } def before_next_page(self): if self.player.choice24 == str(60) and self.player.choice25 == str(30): self.participant.vars['choice24'] = choices()[0] self.participant.vars['choice32'] = choices()[3] self.player.choice23 = str(60) if self.player.choice24 == str(30) and self.player.choice25 == str(30): self.participant.vars['choice24'] = choices()[3] self.participant.vars['choice32'] = choices()[3] if self.player.choice32 == str(60) and self.player.choice31 == str(60): self.participant.vars['choice24'] = choices()[0] self.participant.vars['choice32'] = choices()[0] if self.player.choice31 == str(60) and self.player.choice32 == str(30): self.participant.vars['choice24'] = choices()[0] self.participant.vars['choice32'] = choices()[3] self.player.choice33 = str(30) class blank13(Page): form_model = 'player' timeout_seconds = 1 def is_displayed(self): return (self.round_number == 1 and self.player.choice31 == str(60) and self.player.choice32 == str(60)) \ or (self.round_number == 1 and self.player.choice24 == str(30) and self.player.choice25 == str(30)) class survey3_10_20(Page): form_model = 'player' form_fields = ['choice23', 'choice33'] def is_displayed(self): return (self.round_number == 1 and self.player.choice31 == str(60) and self.player.choice32 == str(60)) \ or (self.round_number == 1 and self.player.choice24 == str(30) and self.player.choice25 == str(30)) def vars_for_template(self): return dict( choice24=self.participant.vars['choice24'], choice25=self.participant.vars['choice25'], choice31=self.participant.vars['choice31'], choice32=self.participant.vars['choice32'], ) def js_vars(self): return { 'choice25': self.participant.vars['choice25'], 'choice24': self.participant.vars['choice24'], 'choice32': self.participant.vars['choice32'], 'choice31': self.participant.vars['choice31'], } def before_next_page(self): if self.player.choice23 == str(60) and self.player.choice24 == str(30): self.participant.vars['choice23'] = choices()[0] self.participant.vars['choice33'] = choices()[3] if self.player.choice24 == str(30) and self.player.choice23 == str(30): self.participant.vars['choice23'] = choices()[3] self.participant.vars['choice33'] = choices()[3] if self.player.choice32 == str(60) and self.player.choice33 == str(60): self.participant.vars['choice23'] = choices()[0] self.participant.vars['choice33'] = choices()[0] if self.player.choice32 == str(60) and self.player.choice33 == str(30): self.participant.vars['choice23'] = choices()[0] self.participant.vars['choice33'] = choices()[3] class survey4(Page): form_model = 'player' form_fields = ['choice34'] def is_displayed(self): return self.round_number == 1 class questionchosen(Page): form_model = 'player' def is_displayed(self): return self.round_number == 1 def vars_for_template(self): return dict( question_chosen=self.participant.vars['baseline'], choice1=self.player.choice1, choice2=self.player.choice2, choice3=self.player.choice3, choice4=self.player.choice4, choice5=self.player.choice5, choice6=self.player.choice6, choice7=self.player.choice7, choice8=self.player.choice8, choice9=self.player.choice9, choice10=self.player.choice10, choice11=self.player.choice11, choice12=self.player.choice12, choice13=self.player.choice13, choice14=self.player.choice14, choice15=self.player.choice15, choice16=self.player.choice16, choice17=self.player.choice17, choice18=self.player.choice18, choice19=self.player.choice19, choice20=self.player.choice20, choice21=self.player.choice21, choice22=self.player.choice22, choice23=self.player.choice23, choice24=self.player.choice24, choice25=self.player.choice25, choice26=self.player.choice26, choice27=self.player.choice27, choice28=self.player.choice28, choice29=self.player.choice29, choice30=self.player.choice30, choice31=self.player.choice31, choice32=self.player.choice32, choice33=self.player.choice33, choose1=self.player.get_choice1_display(), choose2=self.player.get_choice2_display(), choose3=self.player.get_choice3_display(), choose4=self.player.get_choice4_display(), choose5=self.player.get_choice5_display(), choose6=self.player.get_choice6_display(), choose7=self.player.get_choice7_display(), choose8=self.player.get_choice8_display(), choose9=self.player.get_choice9_display(), choose10=self.player.get_choice10_display(), choose11=self.player.get_choice11_display(), choose12=self.player.get_choice12_display(), choose13=self.player.get_choice13_display(), choose14=self.player.get_choice14_display(), choose15=self.player.get_choice15_display(), choose16=self.player.get_choice16_display(), choose17=self.player.get_choice17_display(), choose18=self.player.get_choice18_display(), choose19=self.player.get_choice19_display(), choose20=self.player.get_choice20_display(), choose21=self.player.get_choice21_display(), choose22=self.player.get_choice22_display(), choose23=self.player.get_choice23_display(), choose24=self.player.get_choice24_display(), choose25=self.player.get_choice25_display(), choose26=self.player.get_choice26_display(), choose27=self.player.get_choice27_display(), choose28=self.player.get_choice28_display(), choose29=self.player.get_choice29_display(), choose30=self.player.get_choice30_display(), choose31=self.player.get_choice31_display(), choose32=self.player.get_choice32_display(), choose33=self.player.get_choice33_display(), choose34=self.player.get_choice34_display(), ) def js_vars(self): return { 'question_chosen': self.participant.vars['baseline'], } def before_next_page(self): if self.participant.vars['baseline'] == 1: if self.player.get_choice1_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice1_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[0] if self.participant.vars['baseline'] == 2: if self.player.get_choice2_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice2_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[1]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[1] if self.participant.vars['baseline'] == 3: if self.player.get_choice3_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice3_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[2]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[2] if self.participant.vars['baseline'] == 4: if self.player.get_choice4_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice4_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[3]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[3] if self.participant.vars['baseline'] == 5: if self.player.get_choice5_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice5_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[4]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[4] if self.participant.vars['baseline'] == 6: if self.player.get_choice6_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice6_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[5]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[5] if self.participant.vars['baseline'] == 7: if self.player.get_choice7_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice7_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[6]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[6] if self.participant.vars['baseline'] == 8: if self.player.get_choice8_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice8_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[7]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[7] if self.participant.vars['baseline'] == 9: if self.player.get_choice9_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice9_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[8]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[8] if self.participant.vars['baseline'] == 10: if self.player.get_choice10_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice10_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[9]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[9] if self.participant.vars['baseline'] == 11: if self.player.get_choice11_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice11_display() == str( choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[10]): self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[10] if self.participant.vars['baseline'] == 12: if self.player.get_choice12_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice12_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[0] if self.participant.vars['baseline'] == 13: if self.player.get_choice13_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice13_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[1]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[1] if self.participant.vars['baseline'] == 14: if self.player.get_choice14_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice14_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[2]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[2] if self.participant.vars['baseline'] == 15: if self.player.get_choice15_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice15_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[3]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[3] if self.participant.vars['baseline'] == 16: if self.player.get_choice16_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice16_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[4]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[4] if self.participant.vars['baseline'] == 17: if self.player.get_choice17_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice17_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[5]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[5] if self.participant.vars['baseline'] == 18: if self.player.get_choice18_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice18_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[6]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[6] if self.participant.vars['baseline'] == 19: if self.player.get_choice19_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice19_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[7]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[7] if self.participant.vars['baseline'] == 20: if self.player.get_choice20_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice20_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[8]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[8] if self.participant.vars['baseline'] == 21: if self.player.get_choice21_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice21_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[9]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[9] if self.participant.vars['baseline'] == 22: if self.player.get_choice22_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice22_display() == str( choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[10]): self.participant.vars['time_limit'] = choices()[2] self.participant.vars['budget'] = budget()[10] if self.participant.vars['baseline'] == 23: if self.player.get_choice23_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice23_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[0] if self.participant.vars['baseline'] == 24: if self.player.get_choice24_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice24_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[1]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[1] if self.participant.vars['baseline'] == 25: if self.player.get_choice25_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice25_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[2]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[2] if self.participant.vars['baseline'] == 26: if self.player.get_choice26_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice26_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[3]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[3] if self.participant.vars['baseline'] == 27: if self.player.get_choice27_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice27_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[4]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[4] if self.participant.vars['baseline'] == 28: if self.player.get_choice28_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice28_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[5]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[5] if self.participant.vars['baseline'] == 29: if self.player.get_choice29_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice29_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[6]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[6] if self.participant.vars['baseline'] == 30: if self.player.get_choice30_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice30_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[7]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[7] if self.participant.vars['baseline'] == 31: if self.player.get_choice31_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice31_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[8]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[8] if self.participant.vars['baseline'] == 32: if self.player.get_choice32_display() == str( choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0]): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice32_display() == str( choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[9]): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[9] if self.participant.vars['baseline'] == 33: if self.player.choice33 == str(60): self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.choice33 == str(30): self.participant.vars['time_limit'] = choices()[3] self.participant.vars['budget'] = budget()[10] if self.participant.vars['baseline'] == 34: if self.player.get_choice34_display() == 'Compete with a time limit of ' + str(choices()[0]) + ' seconds per game against the past performance of someone who also had a time limit of ' + str(choices()[0]) + ' seconds per game': self.participant.vars['time_limit'] = choices()[0] self.participant.vars['budget'] = budget()[0] if self.player.get_choice34_display() == 'Compete with a time limit of ' + str(choices()[1]) + ' seconds per game against the past performance of someone who also had a time limit of ' + str(choices()[1]) + ' seconds per game': self.participant.vars['time_limit'] = choices()[1] self.participant.vars['budget'] = budget()[0] # Set of games: a = [[78, 46, 13, 67, 65, 25, 34, 15, 47, 62], [68, 15, 42, 29, 27, 41, 19, 23, 36, 33], [76, 51, 48, 11, 47, 15, 65, 39, 35, 63], [91, 75, 69, 44, 64, 16, 35, 62, 33, 49], [68, 16, 17, 49, 14, 22, 41, 57, 19, 21], [91, 69, 25, 17, 55, 26, 13, 75, 22, 72], [55, 21, 17, 33, 26, 9, 41, 27, 34, 23], [93, 65, 58, 32, 79, 77, 31, 71, 76, 17], [84, 41, 72, 46, 26, 48, 35, 32, 49, 28], [85, 23, 54, 72, 42, 62, 49, 58, 38, 69]] class Instructions(Page): form_model = 'player' form_fields = ['my_page_timeout_seconds', 'starting_budget'] timeout_seconds = 5 def vars_for_template(self): if self.round_number == 1: self.player.my_page_timeout_seconds = self.participant.vars['time_limit'] self.player.starting_budget = self.participant.vars['budget'] for i in range(1, 10): if self.round_number % 10 == i: self.participant.vars['game_number'] = i if self.round_number % 10 == 0: self.participant.vars['game_number'] = 10 return dict( timeout_options=self.participant.vars['time_limit'], game_number=self.participant.vars['game_number'], ) def before_next_page(self): self.participant.vars['sssss'] = time.time() def js_vars(self): return { 'timeout_options': self.participant.vars['time_limit'], } class Game1(Page): form_model = 'player' form_fields = ['correct'] def get_timeout_seconds(self): return self.player.my_page_timeout_seconds def vars_for_template(self): if self.round_number == 1: self.participant.vars['set1'] = a self.player.my_page_timeout_seconds = self.participant.vars['time_limit'] self.player.starting_budget = self.participant.vars['budget'] return dict( question_chosen=self.participant.vars['baseline'], game_number=self.participant.vars['game_number'], n=[self.participant.vars['set1'][0][h] for h in range(0, 10)], payoff1=self.participant.vars['budget'], my_page_timeout_seconds=self.participant.vars['time_limit'], ) for i in range(2, 11): if self.round_number == i: self.player.my_page_timeout_seconds = self.participant.vars['time_limit'] self.player.starting_budget = self.participant.vars['budget'] return dict( question_chosen=self.participant.vars['baseline'], game_number=self.participant.vars['game_number'], n=[self.participant.vars['set1'][i - 1][h] for h in range(0, 10)], payoff1=self.player.in_round(i - 1).payoff1, my_page_timeout_seconds=self.participant.vars['time_limit'], ) def before_next_page(self): self.player.time_spent = math.floor(time.time() - self.participant.vars['sssss']) if self.timeout_happened: self.player.time_spent = self.player.my_page_timeout_seconds if self.round_number == 1: self.player.payoff1 = self.participant.vars['budget'] else: self.player.payoff1 = self.player.in_round(self.round_number - 1).payoff1 if self.player.correct == 1: self.player.payoff1 = self.player.payoff1 else: self.player.payoff1 = self.player.payoff1 - 1 self.participant.vars['payoff1'] = self.player.payoff1 self.participant.vars['time_spent'] = self.player.time_spent self.participant.vars['number_correct'] = self.participant.vars['game_number'] - (10 - self.player.payoff1) def js_vars(self): for i in range(1, 11): if self.round_number == i: return { 'n': [self.participant.vars['set1'][i - 1][h] for h in range(0, 10)], 'timeout_options': self.participant.vars['time_limit'], 'question_chosen': self.participant.vars['baseline'], } class results(Page): form_model = 'player' form_fields = ['payoff1', 'time_spent'] timeout_seconds = 5 def vars_for_template(self): self.participant.vars['results'] = self.player.correct self.participant.vars['payoff1'] = self.player.payoff1 self.participant.vars['time_spent'] = self.player.time_spent self.participant.vars['number_correct'] = self.participant.vars['game_number'] - (10 - self.player.payoff1) self.participant.vars['payoff_round5'] = self.player.payoff1 for i in range(1, 11): if self.round_number == i: return dict( my_page_timeout_seconds=self.participant.vars['time_limit'], game_number=self.participant.vars['game_number'], result=self.participant.vars['results'], payoff1=self.participant.vars['payoff1'], time_spent=self.participant.vars['time_spent'], number_correct=self.participant.vars['number_correct'], question_chosen=self.participant.vars['baseline'], ) def js_vars(self): return { 'payoff1': self.participant.vars['payoff1'], 'time_spent': self.participant.vars['time_spent'], 'number_correct': self.participant.vars['number_correct'], 'question_chosen': self.participant.vars['baseline'], } page_sequence = [instruction_choice, survey1_15, blank1, survey1_14_16, blank2, survey1_13_17, blank3, survey1_12_18, blank4, survey1_11_19, blank5, survey1_10_20, blank1, survey2_15, blank1, survey2_14_16, blank6, survey2_13_17, blank7, survey2_12_18, blank8, survey2_11_19, blank9, survey2_10_20, blank1, survey3_15, blank1, survey3_14_16, blank10, survey3_13_17, blank11, survey3_12_18, blank12, survey3_11_19, blank13, survey3_10_20, blank1, survey4, questionchosen, Instructions, Game1, results]