from otree.api import Bot, Submission from . import * class PlayerBot(Bot): def play_round(self): # Consent + opening intro pages (no forms) yield Consent_Pg yield Intro01 yield Intro02 yield Intro03 yield Intro04 yield Intro05 yield Intro06 yield Intro07 # Intro08 (live page: Draw New Payoffs) yield Submission(Intro08, {}, check_html=False) self.player.num_pf_draws += 1 yield Intro09 yield Intro10 yield Intro11 # Intro12 (live page: Draw New Priority Scores) yield Submission(Intro12, {}, check_html=False) self.player.num_pr_draws += 1 # Intro13 (Your Input — overview of three tasks) yield Intro12b yield Intro13 # Intro14 (Your Input: Island Rankings — intro, no form) yield Intro14 # Intro15 (Your Input: Island Rankings — practice interface) yield Intro15, dict( prac_rank1='A', prac_rank2='B', prac_rank3='C', prac_rank4='D', prac_rank5='E', prac_rank6='F', prac_cap2_rank1='A', prac_cap2_rank2='B', ) # Intro16 (practice expected payoff slider) yield Intro16, dict(prac_ep=150) # Intro17 (practice assignment probability beliefs) yield Intro17, dict( prac_beliefA=20, prac_beliefB=20, prac_beliefC=20, prac_beliefD=20, prac_beliefE=10, prac_beliefF=10, prac_belief0=0, ) yield Intro18, dict(saw_ap_hint=True) yield Intro19 yield Intro20 yield Intro21 # ========================= # Intro22 QUIZ PAGE 1 (Q1-3) # First attempt: WRONG # ========================= yield SubmissionMustFail( Intro22, dict( quiz_q1='100 points', # wrong quiz_q2='100 points', # wrong quiz_q3= "25", # wrong ) ) assert self.player.quiz_attempts1 == 1 # Second attempt: CORRECT yield Intro22, dict( quiz_q1='220 points', quiz_q2='300 points', quiz_q3="Don't Know", ) assert self.player.participant.passed_quiz is True # ========================= # Intro23 QUIZ PAGE 2 (Q4-5) # First attempt: WRONG # ========================= yield SubmissionMustFail( Intro23, dict( quiz_q4='b', # wrong quiz_q5_a=True, quiz_q5_b=False, quiz_q5_c=True, quiz_q5_d=True, quiz_q5_e=True, quiz_q5_f=False, quiz_q5_none=False, ) ) assert self.player.quiz_attempts2 == 1 # Second attempt: CORRECT yield Intro23, dict( quiz_q4='a', quiz_q5_a=False, quiz_q5_b=True, quiz_q5_c=False, quiz_q5_d=False, quiz_q5_e=False, quiz_q5_f=True, quiz_q5_none=True, ) assert self.player.participant.passed_quiz is True yield Intro24 yield Intro25 yield Intro26 yield Intro27 yield Intro28 yield Intro29 # Intro30 (practice round ranking — must rank at least one island) yield Intro30, dict( prac_round_rank1='A', prac_round_rank2='B', ) yield Intro31 # Intro32 (must change both ranking and priorities at least once) yield SubmissionMustFail( Intro32, dict(prac23_changed_ranking=0, prac23_changed_priority=0), ) yield Intro32, dict( prac23_changed_ranking=1, prac23_changed_priority=1, ) yield Intro33 yield Intro34 yield Intro35 yield Intro36 yield Intro37 yield Intro38 # ========================= # Intro41 QUIZ 3 (fail once) # ========================= yield SubmissionMustFail( Intro41, dict(quiz3_q1='b') ) assert self.player.quiz3_err_ct == 1 yield Intro41, dict(quiz3_q1='a')