import random from otree.api import Bot, Submission from . import ( Code, Introduction, NoAI, Instructions1_2a, Instructions1_2b, Comprehension, Instructions, Load, Machine, Transition, Guess1, Guess2, Guess3, Guess4, Guess5, Guess6, Guess7, Guess8, Guess9, Guess10, Guess11, Guess12, Guess13, Guess14, Guess15, Guess16, Post_Guesses_Confidence, PredictionStrategy, FinalComments, ) GUESS_PAGES = [ Guess1, Guess2, Guess3, Guess4, Guess5, Guess6, Guess7, Guess8, Guess9, Guess10, Guess11, Guess12, Guess13, Guess14, Guess15, Guess16, ] class PlayerBot(Bot): def play_round(self): pid = self.participant.id_in_session if self.round_number == 1: yield Submission(Code, {'ID_subject': f'{pid:05d}abcdef1234567890abcd'}, check_html=False) yield Submission(Introduction, check_html=False) yield Submission(NoAI, check_html=False) yield Submission(Instructions1_2a, { 'Example_notes': 'I observe the red, blue and green lights and try to find a pattern with the sound.', }, check_html=False) yield Submission(Instructions1_2b, { 'guess_example': random.randint(0, 1), }, check_html=False) # Correct answers: cq1=1, cq2=2, cq3=3, cq4=2, cq5=3 yield Submission(Comprehension, { 'cq1': 1, 'cq2': 2, 'cq3': 3, 'cq4': 2, 'cq5': 3, }, check_html=False) yield Submission(Instructions, check_html=False) yield Submission(Load, check_html=False) yield Submission(Machine, { 'notes': 'I am trying to identify which light predicts the sound.', }, check_html=False) yield Submission(Transition, check_html=False) for i, page in enumerate(GUESS_PAGES, 1): yield Submission(page, {f'guess{i}': random.randint(0, 1)}, check_html=False) yield Submission(Post_Guesses_Confidence, { 'predicted_correct_self': random.randint(4, 16), 'certainty': random.choice(range(0, 101, 5)), }, check_html=False) if self.round_number == 7: yield Submission(PredictionStrategy, { 'prediction_strategy': 'I focused on identifying which combination of lights most consistently predicted the sound.', 'difficulty': random.randint(1, 5), 'difficulty_certainty': random.choice(range(0, 101, 5)), }, check_html=False) yield Submission(FinalComments, { 'final_comments': 'The experiment was interesting and mentally challenging overall.', }, check_html=False)