from otree.api import Currency as c, currency_range from . import pages from ._builtin import Bot from .models import Constants import random from otree.api import Submission from otree.api import SubmissionMustFail class PlayerBot(Bot): def play_round(self): # Introduction yield Submission(pages.Consent, dict(consent = True)) # If survey is initial if self.player.initial: # Disposition yield Submission(pages.Disposition, dict(cooperative_1=random.choices([1, 6]), cooperative_2=random.choices([1, 6]), cooperative_3=random.choices([1, 6]), militant_1=random.choices([1, 6]), militant_2=random.choices([1, 6]), militant_3=random.choices([1, 6]), militant_4=random.choices([1, 6]), isolationist_1=random.choices([1, 6]), isolationist_2=random.choices([1, 6]), isolationist_3=random.choices([1, 6]), sovereign_1=random.choices([1, 6]), sovereign_2=random.choices([1, 6]), sovereign_3=random.choices([1, 6]), attention=random.choices([1, 6])), check_html=False) # Expertise yield Submission(pages.Expertise, dict(knowledge_1=random.choices([1, 5]), knowledge_2=random.choices([1, 5]), knowledge_3=random.choices([1, 5]), knowledge_4=random.choices([1, 5]), knowledge_5=random.choices([1, 5]), knowledge_6=random.choices([1, 5])), check_html=False) # Demographics yield Submission(pages.Demographics, dict(age=random.choices([1985, 2000]), gender=random.choices([1, 3]), education=random.choices([1, 5]), income=random.choices([1, 7]), resident=random.choices([False, True]), malware=random.choices([False, True])), check_html=False) # Scenario yield Submission(pages.Scenario, check_html=False) # Emotions yield Submission(pages.Emotions, dict(anxiety_1=random.choices([1, 6]), anxiety_2=random.choices([1, 6]), anxiety_3=random.choices([1, 6]), anxiety_4=random.choices([1, 6]), anxiety_5=random.choices([1, 6]), anxiety_6=random.choices([1, 6]), anger_1=random.choices([1, 6]), anger_2=random.choices([1, 6]), anger_3=random.choices([1, 6]), anger_4=random.choices([1, 6])), check_html=False) # Dread yield Submission(pages.Dread, dict(dread_1=random.choices([1, 6]), dread_2=random.choices([1, 6]), dread_3=random.choices([1, 6]), dread_4=random.choices([1, 6]), dread_5=random.choices([1, 6]), dread_6=random.choices([1, 6]), dread_7=random.choices([1, 6]), dread_8=random.choices([1, 6]), dread_9=random.choices([1, 6]), dread_10=random.choices([1, 6])), check_html=False) # Outcome yield Submission(pages.Outcome, dict(censure=random.choices([False, True]), cooperate=random.choices([False, True]), interest=random.choices([False, True]), consequences=random.choices([False, True]), responsible="TEST1", state_target="TEST2"), check_html=False) # Manipulation yield Submission(pages.Manipulation, dict(supportive_check=random.choices([False, True]), partner_check=random.choices([False, True]), state_check=random.choices([False, True])), check_html=False) else: # Scenario yield Submission(pages.Scenario, check_html=False) # Emotions yield Submission(pages.Emotions, dict(anxiety_1=random.choices([1, 6]), anxiety_2=random.choices([1, 6]), anxiety_3=random.choices([1, 6]), anxiety_4=random.choices([1, 6]), anxiety_5=random.choices([1, 6]), anxiety_6=random.choices([1, 6]), anger_1=random.choices([1, 6]), anger_2=random.choices([1, 6]), anger_3=random.choices([1, 6]), anger_4=random.choices([1, 6])), check_html=False) # Dread yield Submission(pages.Dread, dict(dread_1=random.choices([1, 6]), dread_2=random.choices([1, 6]), dread_3=random.choices([1, 6]), dread_4=random.choices([1, 6]), dread_5=random.choices([1, 6]), dread_6=random.choices([1, 6]), dread_7=random.choices([1, 6]), dread_8=random.choices([1, 6]), dread_9=random.choices([1, 6]), dread_10=random.choices([1, 6])), check_html=False) # Outcome yield Submission(pages.Outcome, dict(censure=random.choices([False, True]), cooperate=random.choices([False, True]), interest=random.choices([False, True]), consequences=random.choices([False, True]), responsible="TEST1", state_target="TEST2"), check_html=False) # Manipulation yield Submission(pages.Manipulation, dict(supportive_check=random.choices([False, True]), partner_check=random.choices([False, True]), state_check=random.choices([False, True])), check_html=False) # Disposition yield Submission(pages.Disposition, dict(cooperative_1=random.choices([1, 6]), cooperative_2=random.choices([1, 6]), cooperative_3=random.choices([1, 6]), militant_1=random.choices([1, 6]), militant_2=random.choices([1, 6]), militant_3=random.choices([1, 6]), militant_4=random.choices([1, 6]), isolationist_1=random.choices([1, 6]), isolationist_2=random.choices([1, 6]), isolationist_3=random.choices([1, 6]), sovereign_1=random.choices([1, 6]), sovereign_2=random.choices([1, 6]), sovereign_3=random.choices([1, 6]), attention=random.choices([1, 6])), check_html=False) # Expertise yield Submission(pages.Expertise, dict(knowledge_1=random.choices([1, 5]), knowledge_2=random.choices([1, 5]), knowledge_3=random.choices([1, 5]), knowledge_4=random.choices([1, 5]), knowledge_5=random.choices([1, 5]), knowledge_6=random.choices([1, 5])), check_html=False) # Demographics yield Submission(pages.Demographics, dict(age=random.choices([1985, 2000]), gender=random.choices([1, 3]), education=random.choices([1, 5]), income=random.choices([1, 7]), resident=random.choices([False, True]), malware=random.choices([False, True])), check_html=False)