from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'individual_question' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def is_ai_coin(group: Group): import random proposer=group.get_player_by_id(1) responder=group.get_player_by_id(2) proposer.is_ai_cointoss=random.randint(0,1) responder.is_ai_cointoss=random.randint(0,1) def is_ai_urn(group: Group): import random proposer=group.get_player_by_id(1) responder=group.get_player_by_id(2) proposer.is_ai_urn=random.randint(0,1) responder.is_ai_urn=random.randint(0,1) def is_ai_q1(group: Group): import random proposer=group.get_player_by_id(1) responder=group.get_player_by_id(2) proposer.is_ai_q1=random.randint(0,1) responder.is_ai_q1=random.randint(0,1) def is_ai_q2(group: Group): import random proposer=group.get_player_by_id(1) responder=group.get_player_by_id(2) proposer.is_ai_q2=random.randint(0,1) responder.is_ai_q2=random.randint(0,1) def is_ai_q3(group: Group): import random proposer=group.get_player_by_id(1) responder=group.get_player_by_id(2) proposer.is_ai_q3=random.randint(0,1) responder.is_ai_q3=random.randint(0,1) class Player(BasePlayer): coin_toss = models.IntegerField(label="What's the percentage of the balanced outcome of the consequences of the coin-toss game that you guess?") is_ai_cointoss = models.IntegerField(max=1, min=0) urn_inference = models.IntegerField(label='If the selected ball is green, what do you guess about the probability that the selected urn is A?') is_ai_urn = models.IntegerField(max=1, min=0) question_1 = models.BooleanField(choices=[[True, 'Urn A'], [False, 'Urn B']], label='There are two urns A and B, which filled with balls of two colors (red and white). In each of them, 2/3 of the balls are of one color and 1/3 are of the other. From urn A, 5 balls were drawn randomly and found that 4 were red and 1 was white. From urn B, 20 balls were drawn and 12 were red and 8 were white. Please guess which of the two urns (A or B) is the one with 2/3 red balls and 1/2 white balls.') question_2 = models.IntegerField(label='Please answer the following combinational question. Consider a group of 10 people and they need to form a committee of 8 members. How many ways are there to form 8 committees?', min=0) q3_i = models.IntegerField(label="What's the probability of Event (1) do you think?", max=100, min=0) q3_ii = models.IntegerField(label="What's the probability of Event (2) do you think?", max=100, min=0) q3_iii = models.IntegerField(label="What's the probability of Event (3) do you think?", max=100, min=0) is_ai_q1 = models.IntegerField(max=1, min=0) is_ai_q2 = models.IntegerField(max=1, min=0) is_ai_q3 = models.IntegerField(max=1, min=0) class Individual_question(Page): form_model = 'player' class AiWaitPageQ1(WaitPage): after_all_players_arrive = is_ai_q1 class Question_1(Page): form_model = 'player' form_fields = ['question_1'] timeout_seconds = 60 class AiWaitPageQ2(WaitPage): after_all_players_arrive = is_ai_q2 class Question_2(Page): form_model = 'player' form_fields = ['question_2'] timeout_seconds = 60 class AiWaitPageQ3(WaitPage): after_all_players_arrive = is_ai_q3 class Question_3(Page): form_model = 'player' form_fields = ['q3_i', 'q3_ii', 'q3_iii'] timeout_seconds = 120 class AiWaitPageCoin(WaitPage): after_all_players_arrive = is_ai_coin class Coin_toss(Page): form_model = 'player' form_fields = ['coin_toss'] timeout_seconds = 60 class AiWaitPageUrn(WaitPage): after_all_players_arrive = is_ai_urn class Urn_Inference(Page): form_model = 'player' form_fields = ['urn_inference'] timeout_seconds = 60 class Results(Page): form_model = 'player' page_sequence = [Individual_question, AiWaitPageQ1, Question_1, AiWaitPageQ2, Question_2, AiWaitPageQ3, Question_3, AiWaitPageCoin, Coin_toss, AiWaitPageUrn, Urn_Inference, Results]