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 Value Guess") elif self.participant.vars['time'] == 1: print("I couldn't find partners -1-") else: #if self.player.id_in_group == 1: if random.random() < 0.1: yield Submission(pages.Zero, timeout_happened=True) else: yield pages.Zero if self.group.r_aux_g2 >= 0.5: if self.player.prt == 1: yield pages.Zero1, dict(plyrs_num = random.randint(2, 3), plyrs_select = 1) else: yield pages.Zero1, dict(plyrs_num = random.randint(2, 3), plyrs_select = 0) else: yield pages.ZeroA, dict(plyrs_num = random.randint(1, 2), std_part = 2) yield pages.ZeroR yield pages.First yield pages.First_b, dict(quiz_1 = "$2.00", quiz_3 = "$0.00") yield pages.First_c yield pages.First_d yield pages.Second if self.player.id_in_group == 1: yield pages.Third, dict(private = random.randint(46, 55) , public= random.randint(46, 55) ) elif self.player.id_in_group == 2: yield pages.Third, dict(private = random.randint(46, 55) , public= random.randint(46, 55) ) elif self.player.id_in_group == 3: yield pages.Third, dict(private = random.randint(46, 55) , public= random.randint(46, 55) ) yield pages.Fifth if self.player.id_in_group == 1: yield pages.Fifth_b, dict(offer = random.randint(0, 10)) elif self.player.id_in_group == 2: yield pages.Fifth_b, dict(offer = random.randint(0, 10)) elif self.player.id_in_group == 3: yield pages.Fifth_b, dict(offer = random.randint(0, 10)) yield pages.Sixth yield pages.Seventh, dict(guess3 = random.randint(46, 55)) if self.player.participant.vars['drop'] == 1: print("here I was in transfer task") elif self.participant.vars['time'] == 1: print("I couldn't find partners -2-") else: #if self.player.id_in_group == 2: if random.random() < -0.1: yield Submission(pages.Pre_3, timeout_happened=True) else: yield pages.Pre_3 yield pages.transfer_1 yield pages.transfer_2, dict(transfer=random.randint(0, 73)) if self.player.participant.vars['drop'] == 1: print("I was not shown this survey and the payment") elif self.participant.vars['time'] == 1: print("I couldn't find partners -3-") else: yield pages.Pre_4 #yield pages.Survey1, dict(group_id_1=1, group_id_2=2, group_id_3=3, group_id_4=4) yield pages.Survey2, dict(age=20, gender="male", english="native", check2_q="woodpecker", perception_other=1, personal_action=2) yield pages.Payment