import random from otree.api import Currency as c, currency_range, SubmissionMustFail from . import pages from otree.api import Bot from .models import Constants class PlayerBot(Bot): def play_round(self): form_fields = { 'First': { 'gender': random.choice(Constants.gender_choices)[0], 'age': random.choice(Constants.age_choices)[0], }, 'Second': { 'gen_soc_trust': random.choice(Constants.gen_soc_trust_choices)[0], 'Prosocial': random.choice(Constants.Prosocial_choices)[0], 'literacy': random.choice(Constants.literacy_choices)[0], }, 'Third': { 'SMedia_Use_Frequency': random.choice(Constants.SMedia_Use_Frequency_choices)[0], 'SMedia_TimeSpent': random.choice(Constants.SMedia_TimeSpent_choices)[0], }, 'Fourth': { 'vaccine_status': random.choice(Constants.vaccine_status_choices)[0], 'Compliance': random.choice(Constants.Compliance_choices)[0], }, } for page_name, form_fields in form_fields.items(): yield getattr(pages, page_name), form_fields