from otree.api import Currency as c, currency_range from . import pages from ._builtin import Bot from .models import Constants import random from otree.api import Submission class PlayerBot(Bot): def play_round(self): if self.subsession.round_number == 1: yield (pages.Welcome) yield (pages.Consent) yield (pages.InstructionsPart1) yield (pages.InstructionsPart2) yield (pages.Payment) yield (pages.ComprehensionCheck, { 'qn_lottery': 1, 'qn_list': random.randint(0, 1), 'qn_confidence': 12, }) if self.participant.vars['failed_comprehension']: yield (pages.FailedComprehension) if not self.participant.vars['failed_comprehension']: if self.subsession.round_number == 1: yield (pages.BeginStudy) if self.player.lottery_amount < 0: yield (pages.PriceListStandard, { 'switching_point': random.randint(self.player.lottery_amount, 0), }) else: yield (pages.PriceListStandard, { 'switching_point': random.randint(0, self.player.lottery_amount), }) yield (pages.Valuation, { 'confidence': random.randint(0, 30), }) yield Submission(pages.Wait, check_html=False)