from otree.api import Currency as c, currency_range, expect, Bot from . import * class PlayerBot(Bot): def play_round(self): """write bot code given page sequence and form_fields and display conditions: if There's no form field just yield the page page_sequence: [ID_input, EM_input, firstNameInput, CID_input, Ind_Instruction, Ind_Instruction1, Ind_b1, Ind_module1, Ind_Instruction2, Ind_b2, Ind_module2, Ind_Instruction3, Ind_b3, Ind_module3, Ind_Results] class firstNameInput(Page): form_model = 'player' form_fields = ['FIRST', 'FIRST_2'] """ if self.player.round_number == 1: yield ID_input, dict(ID1=self.player.participant.label) yield (EM_input, dict(EM='1@gmail.com', EM_2='1@gmail.com')) yield (firstNameInput, dict(FIRST='bot', FIRST_2='bot')) yield (CID_input, dict(CID='1', CID_2='1')) yield Ind_Instruction yield Ind_Instruction1 yield Ind_b1 yield (Ind_module1, dict(choicen1='A')) yield ( Ind_module2, dict(choicea1_1='C'), ) if self.player.key_s == ('5' or '5.0'): yield ( Ind_module3, dict(spa_1='A'), ) elif self.player.key_s == ('4' or '4.0'): yield ( Ind_module3, dict(spa_2='B'), ) elif self.player.key_s == 'int4': yield ( Ind_module3, dict(spa_4=2), ) elif self.player.key_s == 'int5': yield ( Ind_module3, dict(spa_5=2), ) elif self.player.key_s == 'int6': yield ( Ind_module3, dict(spa_6=2), ) elif self.player.key_s == 'int8': yield ( Ind_module3, dict(spa_8=2), ) if self.player.round_number == C.NUM_ROUNDS: yield Ind_Results