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.participant.vars['time'] != 1: print("I am with a group, I skipped this one person game") else: if self.player.participant.vars['drop'] == 1: print("here I was in Value Guess B") else: #if self.player.id_in_group == 1: if random.random() < 0.1: yield pages.Zero yield Submission(pages.Zero1, timeout_happened=True) else: yield pages.Zero if self.player.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 yield pages.Third, dict(public= random.randint(46, 55) ) yield pages.Fifth 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") 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'] == 0: 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="chimpanzee", perception_other=1, personal_action=2, accuracy_guess=1,offer_size=1,guess_others=1,guess_self=1) yield pages.Payment else: print("I was not shown this survey and the payment")