from otree.api import Submission from otree.api import Currency as c, currency_range from . import pages from ._builtin import Bot from .models import Constants import random class PlayerBot(Bot): def play_round(self): if self.player.participant.vars['drop'] == 1: print("here I was in choice of lottery") else: yield pages.Pre_1 yield pages.Instructions yield pages.Decision, dict(offer = 99) yield pages.Results if self.session.config['treatment'] == 'sound': if self.player.w_audio == 1: yield pages.QuestionnaireA1, dict(audio1 = random.choice([0,1])) else: yield pages.QuestionnaireA2, dict(audio2 = random.choice([0,1])) else: yield pages.QuestionnaireP, dict(q1=1, q2=1, q3= random.choice([0,1])) yield pages.Quest_C, dict(check_q = "aquamarine") #if self.player.participant.id_in_session == 10: if random.random() < -0.1: yield Submission(pages.Pre_2, timeout_happened=True) else: yield pages.Pre_2