from otree.api import * doc = '\nThis is a standard 2-player trust game where the amount sent by player 1 gets\ntripled. The trust game was first proposed by\n\n Berg, Dickhaut, and McCabe (1995)\n.\n' class C(BaseConstants): NAME_IN_URL = 'trust' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 INSTRUCTIONS_TEMPLATE = 'trust/instructions.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): playerA_line1 = models.LongStringField(label='Continue the story!') playerA_line3 = models.LongStringField(label='Continue the story!') playerA_line5 = models.LongStringField(label='Continue the story!') playerA_line7 = models.LongStringField(label='Continue the story!') playerB_line2 = models.LongStringField(label='Continue the story!') playerB_line4 = models.LongStringField(label='Continue the story!') playerB_line6 = models.LongStringField(label='Continue the story!') playerB_line8 = models.LongStringField(label='Continue the story!') playerA_yand1 = models.LongStringField(label='Your turn!') playerB_yand2 = models.LongStringField(label='Yes-And your partner') playerA_ybut1 = models.LongStringField(label='Your turn!') playerB_ybut2 = models.LongStringField(label='Yes-But your partner') playerA_line11 = models.LongStringField(label='Continue the story!') playerB_line21 = models.LongStringField(label='Yes-And your partner!') def make_q(label): return models.IntegerField(label=label, choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelectHorizontal) def make_q1(label): return models.StringField(label=label, choices=['Never', 'Seldom', 'Sometimes', 'Often', 'Very Often'], widget=widgets.RadioSelectHorizontal) class Player(BasePlayer): q1 = make_q('is reserved') q2 = make_q('is generally trusting') q3 = make_q('tends to be lazy') q4 = make_q('is relaxed, handles stress well') q5 = make_q('has few artistic interests') q6 = make_q('is outgoing, sociable') q7 = make_q('tends to find fault with others') q8 = make_q('does a thorough job') q9 = make_q('gets nervous easily') q10 = make_q('has an active imagination') r1 = make_q1('How often do you read in general?') r21 = make_q1('How often do you read Newspapers?') r22 = make_q1('How often do you read Novels?') r23 = make_q1('How often do you read The Bible?') r24 = make_q1('How often do you read Non-fiction?') r25 = make_q1('How often do you read Magazines?') r26 = make_q1('How often do you read Short Stories?') r27 = make_q1('How often do you read Manuals/ Reports?') r28 = make_q1('How often do you read Comics?') r29 = make_q1('How often do you read Poetry?') story = models.StringField(label='Your story:') survey_1 = "How surprising is your partner's choice?" survey_2 = "Rate your approval of your partner's choice: 5-Highest, 1-lowest" survey_3 = "Rate if your partner's line is relevant to the theme of the story: 5-Extremely relevant, 1-Not relevant" s11 = make_q(survey_1) s12 = make_q(survey_2) s13 = make_q(survey_3) s21 = make_q(survey_1) s22 = make_q(survey_2) s23 = make_q(survey_3) s31 = make_q(survey_1) s32 = make_q(survey_2) s33 = make_q(survey_3) s41 = make_q(survey_1) s42 = make_q(survey_2) s43 = make_q(survey_3) s51 = make_q(survey_1) s52 = make_q(survey_2) s53 = make_q(survey_3) s61 = make_q(survey_1) s62 = make_q(survey_2) s63 = make_q(survey_3) s71 = make_q(survey_1) s72 = make_q(survey_2) s73 = make_q(survey_3) s81 = make_q(survey_1) s82 = make_q(survey_2) s83 = make_q(survey_3) pass class Introduction(Page): form_model = 'player' class PlayerA1(Page): form_model = 'group' form_fields = ['playerA_line1'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerA3(Page): form_model = 'group' form_fields = ['playerA_line3'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerA5(Page): form_model = 'group' form_fields = ['playerA_line5'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerA7(Page): form_model = 'group' form_fields = ['playerA_line7'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerB2(Page): form_model = 'group' form_fields = ['playerB_line2'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerB4(Page): form_model = 'group' form_fields = ['playerB_line4'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerB6(Page): form_model = 'group' form_fields = ['playerB_line6'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerB8(Page): form_model = 'group' form_fields = ['playerB_line8'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerA11(Page): form_model = 'group' form_fields = ['playerA_line11'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerB21(Page): form_model = 'group' form_fields = ['playerB_line21'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerA_YA1(Page): form_model = 'group' form_fields = ['playerA_yand1'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerB_YA2(Page): form_model = 'group' form_fields = ['playerB_yand2'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerA_YB1(Page): form_model = 'group' form_fields = ['playerA_yand1'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerB_YB2(Page): form_model = 'group' form_fields = ['playerB_yand2'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class PlayerA_Survey(Page): form_model = 'player' form_fields = ['s11', 's12', 's13', 's31', 's32', 's33', 's51', 's52', 's53', 's71', 's72', 's73'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 class PlayerB_Survey(Page): form_model = 'player' form_fields = ['s21', 's22', 's23', 's41', 's42', 's43', 's61', 's62', 's63', 's81', 's82', 's83'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 2 class Reading_Survey(Page): form_model = 'player' form_fields = ['r1', 'r21', 'r22', 'r23', 'r24', 'r25', 'r26', 'r27', 'r28', 'r29'] class PlayerAWaitPage(WaitPage): pass class PlayerBWaitPage(WaitPage): pass class Survey(Page): form_model = 'player' form_fields = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9', 'q10'] class Story(Page): timeout_seconds = 60 form_model = 'player' form_fields = ['story'] page_sequence = [PlayerA1, PlayerBWaitPage, PlayerB2, PlayerAWaitPage, PlayerA3, PlayerBWaitPage, \ PlayerB4, PlayerAWaitPage, PlayerA5, PlayerBWaitPage, PlayerB6, PlayerAWaitPage, \ PlayerA7, PlayerBWaitPage, PlayerB8, PlayerAWaitPage, PlayerA_Survey, PlayerB_Survey ] #page_sequence = [PlayerA1, PlayerBWaitPage, PlayerB2, PlayerAWaitPage, PlayerA3, PlayerBWaitPage, \ # PlayerB4, PlayerAWaitPage, PlayerA_Survey, PlayerB_Survey ] page_sequence = [PlayerA_YA1, PlayerBWaitPage, PlayerB_YA2, PlayerAWaitPage] page_sequence = [PlayerA_YB1, PlayerBWaitPage, PlayerB_YB2, PlayerAWaitPage] page_sequence = [PlayerA11, PlayerBWaitPage, PlayerB21, PlayerAWaitPage]