from otree.api import Currency as c, currency_range from . import pages from ._builtin import Bot from .models import Constants import random import string class PlayerBot(Bot): #simulates a risk-neutral subject def play_round(self): #submitted_answer = self.player.current_question()['choice1'] lotteryChoice = list() for i in range(0,10): lotteryChoice.append(random.randint(0,1)) if self.round_number == 1: yield(pages.A_Consent_Form) # generate random ID ID = random.choice(string.ascii_uppercase)+random.choice(string.ascii_uppercase)+random.choice(string.ascii_uppercase)+random.choice(string.digits) #yield(pages.prolificID,{'prolificID':ID}) yield(pages.prolificID,dict(prolificID='5e84319487cffc18c0176729')) yield(pages.B_Instructions_General) yield(pages.C_Intro_Title) yield(pages.D_Description_Lotteries), dict(ControlQuestion1=1,ControlQuestion2=1,ControlQuestion3=1,ControlQuestion4=1,counterWrong_page1=1,) yield(pages.E_PracticeLottery) yield(pages.F_Description_RLIM), dict(ControlQuestion5=1) yield(pages.preQuestion) yield(pages.Question), dict(lotterychoice = lotteryChoice[self.round_number-1]) if self.round_number == Constants.num_rounds: yield(pages.H_End) #yield (pages.Question, {'submitted_answer': submitted_answer}) #if self.round_number == Constants.num_rounds: # yield (pages.Results)