from otree.api import * import random import random # dog for emotional support doc = """ |\_/| | @ @ Woof! | <> _ | _/\------____ ((| |)) | `--' | ____|_ ___| |___.' /_/_____/____/_______| """ class C(BaseConstants): NAME_IN_URL = 'effort_game' # experiment needs two person groups PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 # make a budget so can change it later if we have to STYLE_TEMPLATE = 'effort_game/_Style.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): q1 = models.StringField(label='What country has the highest life expectancy?') #Hongkong q2 = models.StringField(label='Where would you be if you were standing on the Spanish Steps?') #Rome q3 = models.StringField(label='Which language has more native speakers: English or Spanish?') #Spanish q4 = models.StringField(label='What is the most common surname in the United States?') #Smith q5 = models.StringField(label='What year was the United Nation established?') #1945 q6 = models.StringField(label='How many minutes are in a full week?') # 10080 q7 = models.StringField(label='What is a group of crows called?') # a murder q8 = models.StringField(label='How many dots appear on a pair of dice?') #84 q9 = models.StringField(label='Which is the only body part that is fully grown from birth?') # eyes q10 = models.StringField(label='In what country was Elon Musk born?') # South Africa q11 = models.StringField(label='Who performs the voice of Homer Simpson?') # Dan Castellaneta q12 = models.StringField(label='What country has the most islands?') # Sweden q13 = models.StringField(label='How many hearts does have an octopus have?') # 3 q14 = models.StringField(label='What planet is closest to the sun?') # Mercury q15 = models.StringField(label='What phone company produced the 3310?') # Nokia q16 = models.StringField(label='What is the only continent with land in all four hemispheres?') # Africa q17 = models.StringField(label='Which river flows through the Grand Canyon?') # Colorado Rive q18 = models.StringField(label='What is the state capital of New York?') # Albany q19 = models.StringField(label='On what continent would you find the largest desert in the world?') # Antarctica q20 = models.StringField(label='What is the capital of Ireland?') # Dublin q21 = models.StringField(label='How many European capitals does the Danube flow through?') # 4 q22 = models.StringField(label='What is the capital of Canada?') # Ottawa q23 = models.StringField(label='In what capital would you find The Little Mermaid statue?') # Copenhagen q24 = models.StringField(label='On what continent would you find the city of Baku?') # Asia q25 = models.StringField(label='What colors is the flag of the United Nations?') #blue and white q26 = models.StringField(label='Where is Disney European theme park located?') # Paris q27 = models.StringField(label='What is the national flower of Japan?') # Cherry blossom q28 = models.StringField(label='How many days does it take for the Earth to orbit the Sun?') # 365 q29 = models.StringField(label='What is the national animal of Australia?') # Red Kangaroo q30 = models.StringField(label='What is the slang name for New York City, used by locals?') #Gotham q31 = models.StringField(label='When did they open the London underground?') # 1863 q32 = models.StringField(label='What city do The Beatles come from?') # Liverpool q33 = models.StringField(label='Where was the first modern Olympic Games held?') # Athens, 1896 q34 = models.StringField(label='When was Netflix founded?') # 1997 q35 = models.StringField(label='What river is the longest in the world?') # Nile q36 = models.StringField(label='Which language has the most words?') # English q37 = models.StringField(label='What is the smallest country in the country?') # The Vatican q38 = models.StringField(label='How many stripes are there on the US flag?') # 13 q39 = models.StringField(label='What is the first film og the Disney?') # Snow White q40 = models.StringField(label='What is the 4th letter of the Greek alphabet?') # Delta q41 = models.StringField(label='Roald Amundsen was the first man to reach the South Pole, but where was he from?') # Norway q42 = models.StringField(label='What country has won the most World Cups of football?') # Brazil q43 = models.StringField(label='How many bones do we have in an ear?') # 3 q44 = models.StringField(label='What software company is headquartered in Redmond, Washington?') # Microsoft q45 = models.StringField(label='What is the largest Spanish-speaking city in the world?') # Mexico City q46 = models.StringField(label='How many stars are on the Chinese flag?') # 5 q47 = models.StringField(label='What country drinks the most coffee?') # Finland q48 = models.StringField(label='What does FIFA stand for in English?') # International Federation of Association Football q49 = models.StringField(label='What river is the longest one in China?') # the Yangtze River q50 = models.StringField(label='Who was the first person uniting China?') # the Emperor Qin I q_c = models.IntegerField(initial=0) endowment = models.IntegerField() other_q_c = models.IntegerField(initial=0) r = models.FloatField() other_endowment = models.IntegerField() class q1(Page): form_model = 'player' form_fields = ['q1'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q1 == 't': player.q_c += 1 class q2(Page): form_model = 'player' form_fields = ['q2'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q2 == 't': player.q_c += 1 class q3(Page): form_model = 'player' form_fields = ['q3'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q3 == 't': player.q_c += 1 class q4(Page): form_model = 'player' form_fields = ['q4'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q4 == 't': player.q_c += 1 class q5(Page): form_model = 'player' form_fields = ['q5'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q5 == 't': player.q_c += 1 class q6(Page): form_model = 'player' form_fields = ['q6'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q6 == 't': player.q_c += 1 class q7(Page): form_model = 'player' form_fields = ['q7'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q7 == 't': player.q_c += 1 class q8(Page): form_model = 'player' form_fields = ['q8'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q8 == 't': player.q_c += 1 class q9(Page): form_model = 'player' form_fields = ['q9'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q9 == 't': player.q_c += 1 class q10(Page): form_model = 'player' form_fields = ['q10'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q10 == 't': player.q_c += 1 class q11(Page): form_model = 'player' form_fields = ['q11'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q11 == 't': player.q_c += 1 class q12(Page): form_model = 'player' form_fields = ['q12'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q12 == 't': player.q_c += 1 class q13(Page): form_model = 'player' form_fields = ['q13'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q13 == 't': player.q_c += 1 class q14(Page): form_model = 'player' form_fields = ['q14'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q14 == 't': player.q_c += 1 class q15(Page): form_model = 'player' form_fields = ['q15'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q15 == 't': player.q_c += 1 class q16(Page): form_model = 'player' form_fields = ['q16'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q16 == 't': player.q_c += 1 class q17(Page): form_model = 'player' form_fields = ['q17'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q17 == 't': player.q_c += 1 class q18(Page): form_model = 'player' form_fields = ['q18'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q18 == 't': player.q_c += 1 class q19(Page): form_model = 'player' form_fields = ['q19'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q19 == 't': player.q_c += 1 class q20(Page): form_model = 'player' form_fields = ['q20'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q20 == 't': player.q_c += 1 class q21(Page): form_model = 'player' form_fields = ['q21'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q21 == 't': player.q_c += 1 class q22(Page): form_model = 'player' form_fields = ['q22'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q22 == 't': player.q_c += 1 class q23(Page): form_model = 'player' form_fields = ['q23'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q23 == 't': player.q_c += 1 class q24(Page): form_model = 'player' form_fields = ['q24'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q24 == 't': player.q_c += 1 class q25(Page): form_model = 'player' form_fields = ['q25'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q25 == 't': player.q_c += 1 class q26(Page): form_model = 'player' form_fields = ['q26'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q26 == 't': player.q_c += 1 class q27(Page): form_model = 'player' form_fields = ['q27'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q27 == 't': player.q_c += 1 class q28(Page): form_model = 'player' form_fields = ['q28'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q28 == 't': player.q_c += 1 class q29(Page): form_model = 'player' form_fields = ['q29'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q29 == 't': player.q_c += 1 class q30(Page): form_model = 'player' form_fields = ['q30'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q30 == 't': player.q_c += 1 class q31(Page): form_model = 'player' form_fields = ['q31'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q31 == 't': player.q_c += 1 class q32(Page): form_model = 'player' form_fields = ['q32'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q32 == 't': player.q_c += 1 class q33(Page): form_model = 'player' form_fields = ['q33'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q33 == 't': player.q_c += 1 class q34(Page): form_model = 'player' form_fields = ['q34'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q34 == 't': player.q_c += 1 class q35(Page): form_model = 'player' form_fields = ['q35'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q35 == 't': player.q_c += 1 class q36(Page): form_model = 'player' form_fields = ['q36'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q36 == 't': player.q_c += 1 class q37(Page): form_model = 'player' form_fields = ['q37'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q37 == 't': player.q_c += 1 class q38(Page): form_model = 'player' form_fields = ['q38'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q38 == 't': player.q_c += 1 class q39(Page): form_model = 'player' form_fields = ['q39'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q39 == 't': player.q_c += 1 class q40(Page): form_model = 'player' form_fields = ['q40'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q40 == 't': player.q_c += 1 class q41(Page): form_model = 'player' form_fields = ['q41'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q41 == 't': player.q_c += 1 class q42(Page): form_model = 'player' form_fields = ['q42'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q42 == 't': player.q_c += 1 class q43(Page): form_model = 'player' form_fields = ['q43'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q43 == 't': player.q_c += 1 class q44(Page): form_model = 'player' form_fields = ['q44'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q44 == 't': player.q_c += 1 class q45(Page): form_model = 'player' form_fields = ['q45'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q45 == 't': player.q_c += 1 class q46(Page): form_model = 'player' form_fields = ['q46'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q46 == 't': player.q_c += 1 class q47(Page): form_model = 'player' form_fields = ['q47'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q47 == 't': player.q_c += 1 class q48(Page): form_model = 'player' form_fields = ['q48'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q48 == 't': player.q_c += 1 class q49(Page): form_model = 'player' form_fields = ['q49'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q49 == 't': player.q_c += 1 class q50(Page): form_model = 'player' form_fields = ['q50'] timeout_seconds = 10 @staticmethod def before_next_page(player: Player, timeout_happened): if player.q50 == 't': player.q_c += 1 player.r = random.random() class endowment_determined(Page): form_model = 'group' @staticmethod def is_displayed(player: Player): return player.id_in_group == player.id_in_group @staticmethod def app_after_this_page(player: Player, upcoming_apps): group = player.group p1 = group.get_player_by_id(1) p2 = group.get_player_by_id(2) if p1.q_c > p2.q_c: p1.endowment = 8 p2.endowment = 2 elif p1.q_c < p2.q_c: p1.endowment = 2 p2.endowment = 8 if p1.q_c == p2.q_c: if p1.r > p2.r: p1.endowment = 8 p2.endowment = 2 elif p1.r <= p2.r: p1.endowment = 2 p2.endowment = 8 if player.id_in_group == 1: player.other_endowment = p2.endowment player.other_q_c = p2.q_c elif player.id_in_group == 2: player.other_endowment = p1.endowment player.other_q_c = p1.q_c player.participant.endowment = player.endowment class MyWaitPage(WaitPage): pass class result_endowment(Page): pass class Welcome(Page): pass class Instruction(Page): pass class Welcome_SectionII(Page): pass page_sequence = [Welcome_SectionII, Instruction, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q19, q20, q21, q22, q23, q24, q25, q26, q27, q28, q29, q31, q32, q34, q35, q36, q38, q40, q41, q42, q43, q44, q45, q46, q47, q49, q50, MyWaitPage, endowment_determined, MyWaitPage, result_endowment]