from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Welcome(Page): pass class Introduction(Page): pass class Introductionwaitpage(WaitPage): pass class Quiz(Page): form_model = 'player' form_fields = ['Quiz11','Quiz12','Quiz21','Quiz22','Quiz31','Quiz32','Quiz41','Quiz42','Quiz51','Quiz52'] def Quiz11_error_message(self, value): print('value is', value) is_correct = (value == 21) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz12_error_message(self, value): print('value is', value) is_correct = (value == 21) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz21_error_message(self, value): print('value is', value) is_correct = (value == 21) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz22_error_message(self, value): print('value is', value) is_correct = (value == 21) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz31_error_message(self, value): print('value is', value) is_correct = (value == 9) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz32_error_message(self, value): print('value is', value) is_correct = (value == 42) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz41_error_message(self, value): print('value is', value) is_correct = (value == 9) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz42_error_message(self, value): print('value is', value) is_correct = (value == 30) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz51_error_message(self, value): print('value is', value) is_correct = (value == 45) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' def Quiz52_error_message(self, value): print('value is', value) is_correct = (value == 30) if not (is_correct): return '回答不正确, 如不清楚请阅读实验说明或询问实验人员。' class Quizwait(WaitPage): wait_for_all_groups = True class Role(Page): pass class Rolewait(WaitPage): wait_for_all_groups = True class Bsendmessage(Page): """This page is only for B B sends message to A B: send a message """ form_model = 'group' form_fields = ['message'] def is_displayed(self): return self.player.id_in_group == 2 class Bsendmessagewaitpage(WaitPage): body_text = "请等待B编辑信息" wait_for_all_groups = True class Areceivedmessage(Page): """This page is only for A A received the message from B""" def is_displayed(self): return self.player.id_in_group == 1 form_model = 'player' form_fields = ['Invest'] class Investwaitpage(WaitPage): wait_for_all_groups = True class B_decision1(Page): form_model = 'player' form_fields = ['Roll'] def is_displayed(self): return self.player.id_in_group == 2 class Rollingwaitpage(WaitPage): wait_for_all_groups = True class Rolling(Page): pass class B_decision2(Page): form_model = 'player' form_fields = ['Dice'] def is_displayed(self): return self.player.Roll == 1 class RollwaitpageA(WaitPage): body_text = "请等待B掷骰子" wait_for_all_groups = True def is_displayed(self): return self.player.id_in_group == 1 class RollwaitpageB(WaitPage): wait_for_all_groups = True def is_displayed(self): return self.player.Roll == 0 class TaskresultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_group_result() self.group.set_taskpayoffs() class Make_guess(Page): pass class Elicit_A1page(Page): form_model = 'player' form_fields = ['Elicit_A1'] def is_displayed(self): return self.player.id_in_group == 1 class Elicit_A2page(Page): form_model = 'player' form_fields = ['Elicit_A2'] def is_displayed(self): return self.player.id_in_group == 1 class Elicit_A3page(Page): form_model = 'player' form_fields = ['Elicit_A3'] def is_displayed(self): return self.player.id_in_group == 1 class Elicit_B1page(Page): form_model = 'player' form_fields = ['Elicit_B1'] def is_displayed(self): return self.player.id_in_group == 2 class Elicit_B2page(Page): form_model = 'player' form_fields = ['Elicit_B2'] def is_displayed(self): return self.player.id_in_group == 2 class Elicit_B3page(Page): form_model = 'player' form_fields = ['Elicit_B3'] def is_displayed(self): return self.player.id_in_group == 2 class Elicit_B4page(Page): form_model = 'player' form_fields = ['Elicit_B4'] def is_displayed(self): return self.player.id_in_group == 2 class Elicit_AB1page(Page): form_model = 'player' form_fields = ['Elicit_AB1'] class Elicit_AB2page(Page): form_model = 'player' form_fields = ['Elicit_AB2'] class Elicit_Adecisionpage(Page): form_model = 'player' form_fields = ['Elicit_Adecision'] def is_displayed(self): return self.player.id_in_group == 1 class Elicit_Bdecisionpage(Page): form_model = 'player' form_fields = ['Elicit_Bdecision'] def is_displayed(self): return self.player.id_in_group == 2 class Elicitwaitpage(WaitPage): wait_for_all_groups = True class Elicitwaitpage2(WaitPage): def after_all_players_arrive(self): self.subsession.set_rate_broll() self.subsession.set_elicita1_payoffs() self.subsession.set_rate_bsucceed() self.subsession.set_elicita2_payoffs() self.subsession.set_rate_ain() self.subsession.set_elicitb1_payoffs() self.subsession.set_elicita1_inavg() self.subsession.set_elicitb2_payoffs() self.subsession.set_elicita2_inavg() self.subsession.set_elicitb3_payoffs() self.subsession.set_elicita3_inavg() self.subsession.set_elicitb4_payoffs() self.subsession.set_elicitab1_most() self.subsession.set_elicitab1_payoffs() self.subsession.set_elicitab2_most() self.subsession.set_elicitab2_payoffs() class Risklosstask(Page): pass class Survey_C(Page): form_model = 'player' form_fields = ['Survey_C_1', 'Survey_C_2', 'Survey_C_3', 'Survey_C_4', 'Survey_C_5', 'Survey_C_6', 'Survey_C_7', 'Survey_C_8', 'Survey_C_9', 'Survey_C_10', ] class Survey_M(Page): form_model = 'player' form_fields = ['Survey_M_1', 'Survey_M_2', 'Survey_M_3', 'Survey_M_4', 'Survey_M_5', 'Survey_M_6', 'Survey_M_7', 'Survey_M_8','Survey_M_9','Survey_M_10', 'Survey_M_11', 'Survey_M_12', 'Survey_M_13', 'Survey_M_14', 'Survey_M_15', 'Survey_M_16', 'Survey_M_17', 'Survey_M_18','Survey_M_19','Survey_M_20', ] class Survey_D(Page): form_model = 'player' form_fields = ['Survey_D_1', 'Survey_D_2', 'Survey_D_3', 'Survey_D_4', 'Survey_D_5', 'Survey_D_6','Survey_D_7'] class Resultwaitpage(WaitPage): wait_for_all_groups = True class Resultwaitpage2(WaitPage): body_text = "实验报酬计算中" def after_all_players_arrive(self): self.group.set_guess_payoffs() self.group.set_correct_guess() self.group.set_total_payoffs() class Resultoftask(Page): pass page_sequence = [ Welcome, Quiz, Quizwait, Role, Rolewait, Bsendmessage, Bsendmessagewaitpage, Areceivedmessage, Investwaitpage, B_decision1, Rollingwaitpage, Rolling, B_decision2, RollwaitpageB, RollwaitpageA, TaskresultsWaitPage, Make_guess, Elicit_A1page, Elicit_A2page, Elicit_A3page, Elicit_B1page, Elicit_B2page, Elicit_B3page, Elicit_B4page, Elicit_AB1page, Elicit_AB2page, Elicit_Adecisionpage, Elicit_Bdecisionpage, Elicitwaitpage, Elicitwaitpage2, Risklosstask, Survey_C, Survey_M, Survey_D, Resultwaitpage, Resultwaitpage2, Resultoftask, ]