from otree.api import * c = cu doc = '' class Constants(BaseConstants): name_in_url = 'fraud_task' players_per_group = None num_rounds = 1 trial1_A_S = 15 trial1_A_R = 5 trial1_B_S = 5 trial1_B_R = 15 trial2_A_S = 10 trial2_A_R = 5 trial2_B_S = 5 trial2_B_R = 20 trial3_A_S = 6 trial3_A_R = 5 trial3_B_S = 10 trial3_B_R = 4.99 trial4_A_S = 5 trial4_A_R = 10 trial4_B_S = 10 trial4_B_R = 5 trial5_A_S = 8 trial5_A_R = 10 trial5_B_S = 10 trial5_B_R = 12 trial6_A_S = 6 trial6_A_R = 5 trial6_B_S = 5 trial6_B_R = 6 trial7_A_S = 5 trial7_A_R = 20 trial7_B_S = 20 trial7_B_R = 5 trial8_A_S = 6 trial8_A_R = 5 trial8_B_S = 5 trial8_B_R = 15 trial9_A_S = 10 trial9_A_R = 6 trial9_B_S = 10 trial9_B_R = 5 trial10_A_S = 10 trial10_A_R = 12 trial10_B_S = 12 trial10_B_R = 10 trial11_A_S = 5 trial11_A_R = 10 trial11_B_S = 6 trial11_B_R = 5 trial12_A_S = 10 trial12_A_R = 4.99 trial12_B_S = 4 trial12_B_R = 5 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): trial1 = models.IntegerField() trial2 = models.IntegerField() trial3 = models.FloatField() trial4 = models.IntegerField() trial5 = models.IntegerField() trial6 = models.IntegerField() trial7 = models.IntegerField() trial8 = models.IntegerField() trial9r = models.IntegerField() trial10 = models.FloatField() trial11 = models.IntegerField() trial12 = models.IntegerField() trial1_option = models.StringField() trial2_option = models.StringField() trial3_option = models.StringField() trial4_option = models.StringField() trial5_option = models.StringField() trial6_option = models.StringField() trial7_option = models.StringField() trial8_option = models.StringField() trial9_option = models.StringField() trial10_option = models.StringField() trial11_option = models.StringField() trial12_option = models.StringField() class Instruction_CN(Page): form_model = 'player' @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True class Instruction_en(Page): form_model = 'player' @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False class Trial1_CN(Page): form_model = 'player' form_fields = ['trial1'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial1 == 15: player.trial1_option = "dishonest" else: player.trial1_option = "honest" class Trial2_CN(Page): form_model = 'player' form_fields = ['trial2'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial2 == 10: player.trial2_option = "dishonest" else: player.trial2_option = "honest" class Trial3_CN(Page): form_model = 'player' form_fields = ['trial3'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial3 == 10: player.trial3_option = "dishonest" else: player.trial3_option = "honest" class Trial4_CN(Page): form_model = 'player' form_fields = ['trial4'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial4 == 10: player.trial4_option = "dishonest" else: player.trial4_option = "honest" class Trial5_CN(Page): form_model = 'player' form_fields = ['trial5'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial5 == 8: player.trial5_option = "dishonest" else: player.trial5_option = "honest" class Trial6_CN(Page): form_model = 'player' form_fields = ['trial6'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial6 == 6: player.trial6_option = "dishonest" else: player.trial6_option = "honest" class Trial7_CN(Page): form_model = 'player' form_fields = ['trial7'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial7 == 20: player.trial7_option = "dishonest" else: player.trial7_option = "honest" class Trial8_CN(Page): form_model = 'player' form_fields = ['trial8'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial8 == 6: player.trial8_option = "dishonest" else: player.trial8_option = "honest" class Trial9_CN(Page): form_model = 'player' form_fields = ['trial9r'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial9r == 6: player.trial9_option = "honest" else: player.trial9_option = "dishonest" class Trial10_CN(Page): form_model = 'player' form_fields = ['trial10'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial10 == 12: player.trial10_option = "dishonest" else: player.trial10_option = "honest" class Trial11_CN(Page): form_model = 'player' form_fields = ['trial11'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): if player.trial11 == 6: player.trial11_option = "dishonest" else: player.trial11_option = "honest" class Trial12_CN(Page): form_model = 'player' form_fields = ['trial12'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return False else: return True @staticmethod def before_next_page(player, timeout_happened): participant = player.participant if player.trial12 == 10: player.trial12_option = "dishonest" else: player.trial12_option = "honest" participant.vars['trial1'] = player.trial1 participant.vars['trial2'] = player.trial2 participant.vars['trial3'] = player.trial3 participant.vars['trial4'] = player.trial4 participant.vars['trial5'] = player.trial5 participant.vars['trial6'] = player.trial6 participant.vars['trial7'] = player.trial7 participant.vars['trial8'] = player.trial8 participant.vars['trial10'] = player.trial10 participant.vars['trial11'] = player.trial11 participant.vars['trial12'] = player.trial12 class Trial1_en(Page): form_model = 'player' form_fields = ['trial1'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial1 == 15: player.trial1_option = "dishonest" else: player.trial1_option = "honest" class Trial2_en(Page): form_model = 'player' form_fields = ['trial2'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial2 == 10: player.trial2_option = "dishonest" else: player.trial2_option = "honest" class Trial3_en(Page): form_model = 'player' form_fields = ['trial3'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial3 == 10: player.trial3_option = "dishonest" else: player.trial3_option = "honest" class Trial4_en(Page): form_model = 'player' form_fields = ['trial4'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial4 == 10: player.trial4_option = "dishonest" else: player.trial4_option = "honest" class Trial5_en(Page): form_model = 'player' form_fields = ['trial5'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial5 == 8: player.trial5_option = "dishonest" else: player.trial5_option = "honest" class Trial6_en(Page): form_model = 'player' form_fields = ['trial6'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial6 == 6: player.trial6_option = "dishonest" else: player.trial6_option = "honest" class Trial7_en(Page): form_model = 'player' form_fields = ['trial7'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial7 == 20: player.trial7_option = "dishonest" else: player.trial7_option = "honest" class Trial8_en(Page): form_model = 'player' form_fields = ['trial8'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial8 == 6: player.trial8_option = "dishonest" else: player.trial8_option = "honest" class Trial9_en(Page): form_model = 'player' form_fields = ['trial9r'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial9r == 6: player.trial9_option = "honest" else: player.trial9_option = "dishonest" class Trial10_en(Page): form_model = 'player' form_fields = ['trial10'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial10 == 12: player.trial10_option = "dishonest" else: player.trial10_option = "honest" class Trial11_en(Page): form_model = 'player' form_fields = ['trial11'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): if player.trial11 == 6: player.trial11_option = "dishonest" else: player.trial11_option = "honest" class Trial12_en(Page): form_model = 'player' form_fields = ['trial12'] @staticmethod def is_displayed(player): group = player.group if player.id_in_group % 2 == 1: return True else: return False @staticmethod def before_next_page(player, timeout_happened): participant = player.participant if player.trial12 == 10: player.trial12_option = "dishonest" else: player.trial12_option = "honest" participant.vars['trial1'] = player.trial1 participant.vars['trial2'] = player.trial2 participant.vars['trial3'] = player.trial3 participant.vars['trial4'] = player.trial4 participant.vars['trial5'] = player.trial5 participant.vars['trial6'] = player.trial6 participant.vars['trial7'] = player.trial7 participant.vars['trial8'] = player.trial8 participant.vars['trial10'] = player.trial10 participant.vars['trial11'] = player.trial11 participant.vars['trial12'] = player.trial12 page_sequence = [Instruction_CN, Instruction_en, Trial1_CN, Trial2_CN, Trial3_CN, Trial4_CN, Trial5_CN, Trial6_CN, Trial7_CN, Trial8_CN, Trial9_CN, Trial10_CN, Trial11_CN, Trial12_CN, Trial1_en, Trial2_en, Trial3_en, Trial4_en, Trial5_en, Trial6_en, Trial7_en, Trial8_en, Trial9_en, Trial10_en, Trial11_en, Trial12_en]