from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'Frageboegen' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 MY_CONSTANT = 0 LOTTERIE_A_1 = 1 LOTTERIE_A_2 = 0.8 LOTTERIE_B_1 = 2 LOTTERIE_B_2 = 0.1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Frage1 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Ich bin ein vorsichtiger Mensch.', widget=widgets.RadioSelect) Frage2 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Auf mich kann man sich verlassen.', widget=widgets.RadioSelect) Frage3 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Ich gehe gerne und oft Risiken ein.', widget=widgets.RadioSelect) Frage4 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Ich zeige oft meine Gefühle und Emotionen.', widget=widgets.RadioSelect) Frage5 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Meine Entscheidungen sind gut durchdacht.', widget=widgets.RadioSelect) Frage6 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Bitte wählen Sie hier "stimme nicht zu".', widget=widgets.RadioSelect) Frage7 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Ich bin ein ängstlicher Mensch.', widget=widgets.RadioSelect) Frage8 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Ich würde mich als gelassen bezeichnen.', widget=widgets.RadioSelect) Frage9 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='In wichtigen Situationen entscheide ich rational.', widget=widgets.RadioSelect) Frage10 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Sicherheit ist für mich ein entscheidender Faktor.', widget=widgets.RadioSelect) Frage11 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Mich kann man leicht provozieren.', widget=widgets.RadioSelect) Frage12 = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5']], label='Ich habe die Fragen wahrheitsgemäß beantwortet.', widget=widgets.RadioSelect) HL_1 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_2 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_3 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_4 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_5 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_6 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_7 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_8 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_9 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL_10 = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) HL = models.IntegerField(choices=[[1, 'A'], [2, 'B']], widget=widgets.RadioSelect) Alter = models.IntegerField(choices=[[1, '20 oder jünger'], [2, '21 bis 25'], [3, '26 bis 30'], [4, '31 bis 35'], [5, '36 bis 40'], [6, '41 oder älter'], [7, 'keine Angabe']], label='Wie alt sind Sie?', widget=widgets.RadioSelect) Studiengang = models.IntegerField(choices=[[1, 'Wirtschaftswissenschaften'], [2, 'Ingenieurswissenschaften'], [3, 'Naturwissenschaften'], [4, 'Sozialwissenschaften'], [5, 'sonstige'], [6, 'ich studiere nicht'], [7, 'keine Angabe']], label='Welches Studienfach belegen Sie?', widget=widgets.RadioSelect) Geschlecht = models.IntegerField(choices=[[1, 'weiblich'], [2, 'männlich'], [3, 'divers'], [4, 'keine Angabe']], label='Welchem Geschlecht ordnen Sie sich zu?', widget=widgets.RadioSelect) Kommentare = models.StringField(blank=True, label='Haben Sie noch Anmerkungen zum Experiment?') Beweggruende = models.StringField(blank=True, label='Was waren Ihre Beweggründe für oder gegen eine Wahlteilnahme?') Abstimmungsgruende = models.StringField(blank=True, label='Weshalb haben Sie so abgestimmt, wie Sie abgestimmt haben?') Nash = models.IntegerField(choices=[[1, 'ja'], [2, 'nein'], [3, 'nicht sicher'], [4, 'keine Angabe']], label='Sagt Ihnen ein Nash-Gleichgewicht etwas?', widget=widgets.RadioSelect) Kenntnisse = models.IntegerField(choices=[[1, 'sehr gut'], [2, 'gut'], [3, 'durchschnittlich'], [4, 'eher schlecht'], [5, 'schlecht'], [6, 'keine Angabe']], label='Wie gut würden Sie Ihre Kenntnisse in Spieltheorie bewerten?', widget=widgets.RadioSelect) Erfahrung = models.IntegerField(choices=[[1, 'noch keine'], [2, '1 bis 2'], [3, '3 bis 5'], [4, '6 bis 10'], [5, '11 oder mehr'], [6, 'keine Angabe']], label='An wie vielen spieltheoretischen Experimente (im KD2Lab oder online) haben Sie ungefähr schon teilgenommen?', widget=widgets.RadioSelect) Auszahlung = models.CurrencyField() auszahlung_EURO = models.FloatField() auszahlung_nur_experiment = models.FloatField() def set_payoff_HL(player: Player): participant = player.participant import random player.participant.vars['HL_row'] = random.randint(1,10) player.participant.vars['HL_random'] = random.randint(1,10) choices = [player.HL_1,player.HL_2,player.HL_3,player.HL_4,player.HL_5,player.HL_6,player.HL_7,player.HL_8,player.HL_9,player.HL_10] player.participant.vars['HL_choice'] = choices[player.participant.vars['HL_row']-1] if player.participant.vars['HL_random'] <= player.participant.vars['HL_row']: if player.participant.vars['HL_choice'] ==1: player.participant.vars['payoff_HL'] = C.LOTTERIE_A_1 else : player.participant.vars['payoff_HL'] = C.LOTTERIE_B_1 else: if player.participant.vars['HL_choice'] == 1 : player.participant.vars['payoff_HL'] = C.LOTTERIE_A_2 else : player.participant.vars['payoff_HL'] = C.LOTTERIE_B_2 player.payoff = player.participant.vars['payoff_HL'] class Likert_Scale(Page): form_model = 'player' form_fields = ['Frage1', 'Frage2', 'Frage3', 'Frage4', 'Frage5', 'Frage6', 'Frage7', 'Frage8', 'Frage9', 'Frage10', 'Frage11', 'Frage12'] class HL(Page): form_model = 'player' form_fields = ['HL_1', 'HL_2', 'HL_3', 'HL_4', 'HL_5', 'HL_6', 'HL_7', 'HL_8', 'HL_9', 'HL_10'] @staticmethod def vars_for_template(player: Player): return dict( f1 = C.LOTTERIE_A_1, f2 = C.LOTTERIE_A_2, f3 = C.LOTTERIE_B_1, f4 = C.LOTTERIE_B_2) @staticmethod def before_next_page(player: Player, timeout_happened): participant = player.participant import random player.participant.vars['HL_row'] = random.randint(1,10) player.participant.vars['HL_random'] = random.randint(1,10) choices = [player.HL_1,player.HL_2,player.HL_3,player.HL_4,player.HL_5,player.HL_6,player.HL_7,player.HL_8,player.HL_9,player.HL_10] player.participant.vars['HL_choice'] = choices[player.participant.vars['HL_row']-1] if player.participant.vars['HL_random'] <= player.participant.vars['HL_row']: if player.participant.vars['HL_choice'] ==1: player.participant.vars['payoff_HL'] = C.LOTTERIE_A_1 else : player.participant.vars['payoff_HL'] = C.LOTTERIE_B_1 else: if player.participant.vars['HL_choice'] == 1 : player.participant.vars['payoff_HL'] = C.LOTTERIE_A_2 else : player.participant.vars['payoff_HL'] = C.LOTTERIE_B_2 player.payoff = player.participant.vars['payoff_HL']*10 class Ergebnisse_HL(Page): form_model = 'player' @staticmethod def vars_for_template(player: Player): participant = player.participant return dict( payoff_HL = player.participant.vars['payoff_HL'], row = player.participant.vars['HL_row'], value = player.participant.vars['HL_random'], choice = player.participant.vars['HL_choice'], p_A_1 = player.participant.vars['HL_row'], p_A_2 = 10-player.participant.vars['HL_row'], p_B_1 = player.participant.vars['HL_row'], p_B_2 = 10-player.participant.vars['HL_row']) class DemographischeDaten(Page): form_model = 'player' form_fields = ['Alter', 'Studiengang', 'Geschlecht', 'Nash', 'Kenntnisse', 'Erfahrung'] class Freitext(Page): form_model = 'player' form_fields = ['Abstimmungsgruende', 'Beweggruende', 'Kommentare'] class Payoffs(Page): form_model = 'player' @staticmethod def vars_for_template(player: Player): participant = player.participant return dict( auszahlung_fragen = participant.richtige_antworten *5, payoff_HL = float(player.participant.vars['payoff_HL']), auszahlung_experiment = participant.payoff - (float(player.participant.vars['payoff_HL'])*10), auszahlung_experiment2 = float(float(participant.payoff)/10 - float(player.participant.vars['payoff_HL'])), auszahlung_EURO = float(participant.payoff)/10 +4, richtig = participant.richtige_antworten ) class Ende(Page): form_model = 'player' page_sequence = [Likert_Scale, HL, Ergebnisse_HL, DemographischeDaten, Freitext, Payoffs, Ende]