from otree.api import Currency as c, currency_range, expect, Bot, Submission from . import * from random import randint class PlayerBot(Bot): dice = Constants.dice q_corrects = Constants.q_corrects def play_round(self): participant = self.participant if not (participant.no_consent or participant.unmatched or participant.dropout): for page in page_sequence: if page != WaitingPart2: if page == Instructions: yield Submission(page, check_html=False) elif page == ExP8: yield page, dict(report=randint(self.dice[0], self.dice[1])) elif page == ExP12 and self.participant.vars['treatment'] != 'manualrand': yield page, dict(price=randint(self.dice[0], self.dice[1])) elif page in [Quiz1, Quiz2, Quiz4]: yield page, {k: self.q_corrects[k] for k in page.form_fields} else: yield page