from otree.api import Currency as c, currency_range, expect, Bot from . import * #from .init import Constants import random from otree.api import Submission from otree.api import SubmissionMustFail class PlayerBot(Bot): def play_round(player): # Introduction # yield Submission(pages.Consent, dict(consent = True)) # If survey is initial #if player.initial: # Demographic - Part 1 yield Submission(pages.SurveyDemo1, dict(gender=random.choices([1, 3]), citizen=random.choices([1, 3]), education=random.choices([1, 6])), check_html=False) # Demographic - Part 2 yield Submission(pages.SurveyDemo2, dict(partyid=random.choices([1, 4]), partyid_imp=random.choices([1, 5]), zipcode=random.choices([1, 5])), check_html=False) # Identity Questions yield Submission(pages.SurveyIdentity, dict(racialid_1=random.choices([1, 6]), ethnicid_2=random.choices([1, 6]), americanid_3=random.choices([1, 6]), politicalid_4=random.choices([1, 6]), attention=random.choices([1, 6])), check_html=False) # Network yield Submission(pages.SurveyNetwork, dict(network=random.choices([1, 10]), whitefri=random.choices([1, 10]), blackfri=random.choices([1, 10]), hispanicfri=random.choices([1, 10]), asianfri=random.choices([1, 10])), check_html=False) # Discrimination yield Submission(pages.SurveyDiscrimination, dict(contact=random.choices([1, 5]), discriminatio_per=random.choices([1, 5]), discrimination_group=random.choices([1, 5]), microaggression=random.choices([1, 5])), check_html=False) yield Submission(pages.SurveyTrust1, dict(whitetrust_1=random.choices([1, 5]), govertrust_2=random.choices([1, 5]), latinotrust_3=random.choices([1, 5]), friendtrust_4=random.choices([1, 5]), attention2=random.choices([1, 5])), check_html=False) yield Submission(pages.SurveyTrust2, dict(familytrust_6=random.choices([1, 5]), blacktrust_7=random.choices([1, 5]), generaltrust_8=random.choices([1, 5]), asiantrust_9=random.choices([1, 5])), check_html=False) yield Submission(pages.SurveyRatings, dict(whiterating=random.choices([1, 100]), demorating=random.choices([1, 100]), blackrating=random.choices([1, 100]), asianrating=random.choices([1, 100]), immigrantrating=random.choices([1, 100]), latinorating=random.choices([1, 100]), repubrating=random.choices([1, 100])), check_html=False)