import random from otree.api import * doc = """ Your app description """ class Subsession(BaseSubsession): pass class Constants(BaseConstants): FORM_TEMPLATE = __name__ + '/form.html' name_in_url = 'Experiment' players_per_group = 2 endowment = 10 blue_bonus = 0.05 yellow_bonus = 0.10 tasks1 = ['UG', 'Doubled', 'Half', 'DG', 'EarnD', 'EarnR', 'PGG', 'BE'] num_rounds = len(tasks1) + 1 questions = ['UG_1', 'UG_2', 'UG_3', 'UG_4', 'UG_5', 'UG_6', 'UG_7', 'UG_8', 'UG_9', 'UG_10', 'UG_11', 'Doubled_1', 'Doubled_2', 'Doubled_3', 'Doubled_4', 'Doubled_5', 'Doubled_6', 'Doubled_7', 'Doubled_8', 'Doubled_9', 'Doubled_10', 'Doubled_11', 'Half_1', 'Half_2', 'Half_3', 'Half_4', 'Half_5', 'Half_6', 'Half_7', 'Half_8', 'Half_9', 'Half_10', 'Half_11', 'DG_1', 'DG_2', 'DG_3', 'DG_4', 'DG_5', 'DG_6', 'DG_7', 'DG_8', 'DG_9', 'DG_10', 'DG_11', 'EarnR_1', 'EarnR_2', 'EarnR_3', 'EarnR_4', 'EarnR_5', 'EarnR_6', 'EarnR_7', 'EarnR_8', 'EarnR_9', 'EarnR_10', 'EarnR_11', 'EarnD_1', 'EarnD_2', 'EarnD_3', 'EarnD_4', 'EarnD_5', 'EarnD_6', 'EarnD_7', 'EarnD_8', 'EarnD_9', 'EarnD_10', 'EarnD_11', 'N_2', 'C_2', 'N_4', 'C_4', 'N_8', 'C_8', 'N_16', 'C_16', 'PGG1_0', 'PGG1_0', 'PGG1_2', 'PGG1_4', 'PGG1_6', 'PGG1_8', 'PGG1_10', 'PGG2_0', 'PGG2_2', 'PGG2_4', 'PGG2_6', 'PGG2_8', 'PGG2_10', 'PGG3_0', 'PGG3_2', 'PGG3_4', 'PGG3_6', 'PGG3_8', 'PGG3_10', 'PGG4_0', 'PGG4_2', 'PGG4_4', 'PGG4_6', 'PGG4_8', 'PGG4_10'] class Group(BaseGroup): contribution_group = models.CurrencyField rejection_group = models.CurrencyField class Player(BasePlayer): consent = models.IntegerField(widget=widgets.RadioSelect, label="", choices=[[0, 'Consent and Proceed'], [1, 'Leave this survey']]) RFT_balls_in_blue = models.IntegerField(min=0, max=20) RFT_balls_in_yellow = models.IntegerField(min=0, max=20) contribution = models.IntegerField(widget=widgets.RadioSelectHorizontal, label="How much will you like to offer to Person B?", choices=[[0, "0€"], [1, "1€"], [2, "2€"], [3, "3€"], [4, "4€"], [5, "5€"], [6, "6€"], [7, "7€"], [8, "8€"], [9, "9€"], [10, "10€"]]) rejection = models.IntegerField(widget=widgets.RadioSelectHorizontal, label="What is the lowest offer you are willing to accept?", choices=[[0, "0€"], [1, "1€"], [2, "2€"], [3, "3€"], [4, "4€"], [5, "5€"], [6, "6€"], [7, "7€"], [8, "8€"], [9, "9€"], [10, "10€"]]) code = models.StringField(label="Insert your code here") treatment = models.StringField() payoff_norms = models.CurrencyField() payoff_rule = models.CurrencyField() payoff_ug = models.CurrencyField() payoff_total = models.CurrencyField() recall = models.IntegerField(choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], widget=widgets.RadioSelectHorizontal, label="Please use a scale from 0 to 10 where 0 means you are “I did not " "remember anything” and a 10 means you are “I did remember everything”. " "You can also use the values in-between to indicate where you fall on the scale.") donation = models.CurrencyField(min=0, max=1000, label="") risk = models.IntegerField(choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], widget=widgets.RadioSelectHorizontal, label="Please use a scale from 0 to 10 where 0 means you are “completely " "unwilling to take risks” and a 10 means you are “very willing " "to take risks”. " "You can also use the values in-between to indicate where you fall on the scale.") altruistic = models.IntegerField(choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], widget=widgets.RadioSelectHorizontal, label=" Please use a scale from 0 to 10, where 0 means you are “completely " "unwilling to share” and a 10 means you are “very willing to share”. " "You can also use the values in-between to indicate where you fall " "on the scale.") rules = models.IntegerField(choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], widget=widgets.RadioSelectHorizontal, label=" Please use a scale from 0 to 10, where 0 means you are “completely " "unwilling to follow rules” and a 10 means you are “very willing to follow " "rules” You can also use the values in-between to indicate where you fall " "on the scale.") # This is for main choices, each variable is one row in the choice table MPL UG_1 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_3 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_5 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_7 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_9 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) UG_11 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_1 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_3 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_5 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_7 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_9 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Doubled_11 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_1 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_3 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_5 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_7 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_9 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) Half_11 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_1 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_3 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_5 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_7 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_9 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) DG_11 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_1 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_3 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_5 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_7 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_9 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnR_11 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_1 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_3 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_5 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_7 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_9 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) EarnD_11 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) N_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) C_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) N_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) C_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) N_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) C_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) N_16 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) C_16 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG1_0 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG1_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG1_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG1_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG1_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG1_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG2_0 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG2_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG2_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG2_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG2_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG2_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG3_0 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG3_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG3_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG3_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG3_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG3_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG4_0 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG4_2 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG4_4 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG4_6 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG4_8 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) PGG4_10 = models.PositiveIntegerField(choices=[[1, '

Very Inappropriate

'], [2, '

Inappropriate

'], [3, '

Rather Inappropriate

'], [4, '

Rather Appropriate

'], [5, '

Appropriate

'], [6, '

Very Appropriate

']], widget=widgets.RadioSelectHorizontal) A = models.PositiveIntegerField(choices=[[1, '

Très inapproprié

'], [2, '

Inapproprié

'], [3, '

Plutôt inapproprié

'], [4, '

Plutôt approprié

'], [5, '

Approprié

'], [6, '

Très approprié

']], widget=widgets.RadioSelectHorizontal) B = models.PositiveIntegerField(choices=[[1, '

Très inapproprié

'], [2, '

Inapproprié

'], [3, '

Plutôt inapproprié

'], [4, '

Plutôt approprié

'], [5, '

Approprié

'], [6, '

Très approprié

']], widget=widgets.RadioSelectHorizontal) C = models.PositiveIntegerField(choices=[[1, '

Très inapproprié

'], [2, '

Inapproprié

'], [3, '

Plutôt inapproprié

'], [4, '

Plutôt approprié

'], [5, '

Approprié

'], [6, '

Très approprié

']], widget=widgets.RadioSelectHorizontal) D = models.PositiveIntegerField(choices=[[1, '

Très inapproprié

'], [2, '

Inapproprié

'], [3, '

Plutôt inapproprié

'], [4, '

Plutôt approprié

'], [5, '

Approprié

'], [6, '

Très approprié

']], widget=widgets.RadioSelectHorizontal) DG1 = models.PositiveIntegerField(choices=[[1, 'Person A earns 3€ and Person B earns 7€.'], [2, 'Person A earns 5€ and Person B earns 5€.'], [3, 'Person A earns 7€ and Person B earns 3€.']], label="How much does Person A and Person B earn, if Person A gives 3€ to Person B?", widget=widgets.RadioSelect) DG2 = models.PositiveIntegerField(choices=[[1, 'Person A earns 3€ and Person B earns 7€.'], [2, 'Person A earns 5€ and Person B earns 5€.'], [3, 'Person A earns 7€ and Person B earns 3€.']], label="How much does Person A and Person B earn, if Person A gives 7€ to Person B?", widget=widgets.RadioSelect) UG1 = models.PositiveIntegerField(choices=[[1, 'Person A earns 7€ and Person B earns 3€.'], [2, 'Person A earns 0€ and Person B earns 0€.'], [3, 'Person A earns 3€ and Person B earns 7€.']], label="How much does Person A and Person B earn, if Person A offers 3€ to " "Person B and Person B rejects the offer?", widget=widgets.RadioSelect) UG2 = models.PositiveIntegerField(choices=[[1, 'Person A earns 7€ and Person B earns 3€.'], [2, 'Person A earns 0€ and Person B earns 0€.'], [3, 'Person A earns 3€ and Person B earns 7€.']], label="How much does Person A and Person B earn, if Person A offers 3€" " to Person B and Person B accepts the offer? ", widget=widgets.RadioSelect) Doubled1 = models.PositiveIntegerField(choices=[[1, 'Person A earns 3€ and Person B earns 7€.'], [2, 'Person A earns 7€ and Person B earns 6€.'], [3, 'Person A earns 7€ and Person B earns 3€. ']], label="How much does Person A and Person B earn, if Person A gives 3€ to Person B?", widget=widgets.RadioSelect) Doubled2 = models.PositiveIntegerField(choices=[[1, 'Person A earns 3€ and Person B earns 7€.'], [2, 'Person A earns 7€ and Person B earns 3€.'], [3, 'Person A earns 3€ and Person B earns 14€.']], label="How much does Person A and Person B earn, if Person A gives 7€ to Person B?", widget=widgets.RadioSelect) Half1 = models.PositiveIntegerField(choices=[[1, 'Person A earns 3€ and Person B earns 7€.'], [2, 'Person A earns 7€ and Person B earns 1.50€.'], [3, 'Person A earns 7€ and Person B earns 3€.']], label="How much does Person A and Person B earn, if Person A gives 3€ to Person B?", widget=widgets.RadioSelect) Half2 = models.PositiveIntegerField(choices=[[1, 'Person A earns 3€ and Person B earns 7€.'], [2, 'Person A earns 7€ and Person B earns 3€.'], [3, 'Person A earns 3€ and Person B earns 3.50€. ']], label="How much does Person A and Person B earn, if Person A gives 7€ to Person B?", widget=widgets.RadioSelect) EarnD1 = models.PositiveIntegerField(choices=[[1, 'Both Person A and Person B completed a ' 'questionnaire that 30 minutes.'], [2, 'Person A completed a questionnaire and Person A ' 'divides the amount earned by Person A. '], [3, 'Person B completed a questionnaire and Person' ' A divides the amount earned by Person B.']], label="Which of the following statements is correct regarding " "the described situation?", widget=widgets.RadioSelect) EarnR1 = models.PositiveIntegerField(choices=[[1, 'Both Person A and Person B completed a questionnaire that' ' 30 minutes.'], [2, 'Person A completed a questionnaire and Person A ' 'divides the amount earned by Person A.'], [3, 'Person B completed a questionnaire and ' 'Person A divides the amount earned by Person B. ']], label="Which of the following statements is correct regarding the " "described situation?", widget=widgets.RadioSelect) BE1 = models.PositiveIntegerField(choices=[[1, '10€'], [2, '7€'], [3, 'To answer this question it is necessary to know' ' the actions selected by other group members.']], label="How much Person A earns if he selects action X?", widget=widgets.RadioSelect) BE2 = models.PositiveIntegerField(choices=[[1, '10€'], [2, '7€'], [3, 'To answer this question it is necessary to know' ' the actions selected by other group members.']], label="Which of the following statements is correct regarding the " "described situation?", widget=widgets.RadioSelect) PGG = models.PositiveIntegerField(choices=[[1, 'The amount deposited to the PUBLIC account ' 'is divided equally among group members regardless of ' 'their contributions to the PUBLIC account. '], [2, 'Person A knows the amount deposited to the ' 'PUBLIC account by other group member before taking his decision.'], [3, 'The earnings of Person A depend only on his decisions.']], label="Which of the following statements is correct regarding the described situation?", widget=widgets.RadioSelect) payment_norms = models.PositiveIntegerField( choices=[[1, 'All actions you evaluate will determine your payment in this task.'], [2, 'Your payment in this task only depend on your evaluations and on chance.'], [3, 'Any action you evaluate can be selected to determine your payment in this task. ']], label="Which of the following statements is true regarding the payment in this task?", widget=widgets.RadioSelect) payment_ug = models.PositiveIntegerField(choices=[[1, 'Both of the decisions you will make in the role of Person A ' 'and Person B will affect your payment. '], [2, 'Any of the decisions you will make in the role of Person' ' A and Person B may affect your payment. '], [3, 'Your payment in this task only depends on your decisions.']], label="Which of the following statements is true regarding the payment in this task?", widget=widgets.RadioSelect) UG1_play = models.PositiveIntegerField(choices=[[1, 'Person A earns 7€ and Person B earns 3€.'], [2, 'Person A earns 0€ and Person B earns 0€.'], [3, 'Person A earns 3€ and Person B earns 7€.']], label="How much does Person A and Person B earn, if Person A offers 3€ to " "Person B and Person B rejects the offer?", widget=widgets.RadioSelect) UG2_play = models.PositiveIntegerField(choices=[[1, 'Person A earns 7€ and Person B earns 3€.'], [2, 'Person A earns 0€ and Person B earns 0€.'], [3, 'Person A earns 3€ and Person B earns 7€.']], label="How much does Person A and Person B earn, if Person A offers 3€" " to Person B and Person B accepts the offer? ", widget=widgets.RadioSelect) UG1_payment = models.PositiveIntegerField(choices=[[1, 'Both of the decisions you will make in' 'the role of Person A and Person B will affect your payment.'], [2, 'Any of the decisions you will make in the role of' ' Person A and Person B may affect your payment.'], [3, 'Your payment in this task only depends on your decisions.']], label="Which of the following statements is true regarding the payment in this task?", widget=widgets.RadioSelect) # # These variables are collected in the final questionnaire gender = models.StringField(widget=widgets.RadioSelectHorizontal(), choices=['Male', 'Female']) age = models.IntegerField(choices=range(18, 60, 1)) Study = models.TextField(label="What are your current field and level of studies? (example: Law M1). In case you " "are not" " currently studying, what are your last studies?") Nationality = models.TextField(label="What is your nationality? (example: French)") # FUNCTIONS def creating_session(subsession: Subsession): payment = random.sample(range(1, len(Constants.questions) - 12), 1) import itertools responses = dict() numberround = dict() for i in Constants.questions: responses[i] = {'Very Inappropriate': 0, 'Inappropriate': 0, 'Rather Inappropriate': 0, 'Rather Appropriate': 0, 'Appropriate': 0, 'Very Appropriate': 0} numberround[i] = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0} subsession.session.vars['responses'] = responses subsession.session.vars['rounds_to_pay'] = payment treatment = itertools.cycle(['A', 'B']) for player in subsession.get_players(): player.payoff_norms = 0 player.payoff_ug = 0 player.payoff_rule = 0 player.payoff_total = 0 player.treatment = next(treatment) player.participant.vars['round'] = numberround player.participant.vars['consent1'] = 2 if subsession.round_number == 1: T1 = Constants.tasks1.copy() random.shuffle(T1) if player.treatment == 'A': l = ['UG_play'] for i in T1: l.append(i) player.task = l round_numbers = list(range(1, Constants.num_rounds + 1)) player.participant.vars['task_rounds'] = dict(zip(player.task, round_numbers)) else: l = T1 l.append('UG_play') player.task = l round_numbers = list(range(1, Constants.num_rounds + 1)) player.participant.vars['task_rounds'] = dict(zip(player.task, round_numbers)) # if subsession.round_number == 1: # for p in subsession.get_players(): # round_numbers = list(range(1, Constants.num_rounds + 1)) # random.shuffle(round_numbers) # p.participant.vars['task_rounds'] = dict(zip(Constants.tasks, round_numbers)) def set_payoffs(group: Group): random_var = random.uniform(0, 1) p1 = group.get_player_by_id(1) p2 = group.get_player_by_id(2) if random_var <= 0.5: # p1 proposer and p2 recipient if p1.in_round(1).contribution >= p2.in_round(9).rejection: p1.payoff_ug = 10 - p1.in_round(1).contribution p2.payoff_ug = p1.in_round(1).contribution else: p1.payoff_ug = 0 p2.payoff_ug = 0 else: # p2 proposer and p1 recipient if p2.in_round(9).contribution >= p1.in_round(1).rejection: p2.payoff_ug = 10 - p2.in_round(9).contribution p1.payoff_ug = p2.in_round(9).contribution else: p1.payoff_ug = 0 p2.payoff_ug = 0 for i in group.subsession.session.vars['rounds_to_pay']: vector2 = [] winnerA = keys_with_top_values(group.subsession.session.vars['responses'][Constants.questions[i]]) for k in winnerA: if k == 'Very Inappropriate': vector2.append(1) else: if k == 'Inappropriate': vector2.append(2) else: if k == 'Rather Inappropriate': vector2.append(3) else: if k == 'Rather Appropriate': vector2.append(4) else: if k == 'Appropriate': vector2.append(5) else: vector2.append(6) num = key_with_top_values_int(p1.participant.vars['round'][Constants.questions[i]]) if eval('p1.' + 'in_round' + '(' + 'num' + ').' + Constants.questions[i]) in vector2: p1.payoff_norms = p1.payoff_norms + 8 if i > len(Constants.questions) - 24: j = i + 12 vector3 = [] winnerB = keys_with_top_values(group.subsession.session.vars['responses'][Constants.questions[j]]) for m in winnerB: if m == 'Very Inappropriate': vector3.append(1) else: if m == 'Inappropriate': vector3.append(2) else: if m == 'Rather Inappropriate': vector3.append(3) else: if m == 'Rather Appropriate': vector3.append(4) else: if m == 'Appropriate': vector3.append(5) else: vector3.append(6) num2 = key_with_top_values_int(p2.participant.vars['round'][Constants.questions[j]]) if eval('p2.' + 'in_round(' + 'num2' + ').' + Constants.questions[j]) in vector3: p2.payoff_norms = p2.payoff_norms + 8 else: num2 = key_with_top_values_int(p2.participant.vars['round'][Constants.questions[i]]) if eval('p2.' + 'in_round' + '(' + 'num2' + ').' + Constants.questions[i]) in vector2: p2.payoff_norms = p2.payoff_norms + 8 p1.participant.vars['RFT_balls_in_blue'] = p1.RFT_balls_in_blue p1.participant.vars['RFT_balls_in_yellow'] = p1.RFT_balls_in_yellow p1.participant.vars['RFT_profit'] = p1.payoff p2.participant.vars['RFT_balls_in_blue'] = p2.RFT_balls_in_blue p2.participant.vars['RFT_balls_in_yellow'] = p2.RFT_balls_in_yellow p2.participant.vars['RFT_profit'] = p2.payoff p1.payoff_rule = p1.RFT_balls_in_blue * Constants.blue_bonus + p1.RFT_balls_in_yellow * Constants.yellow_bonus p2.payoff_rule = p2.RFT_balls_in_blue * Constants.blue_bonus + p2.RFT_balls_in_yellow * Constants.yellow_bonus p1.payoff = p1.payoff_norms + p1.payoff_ug + p1.payoff_rule p2.payoff = p2.payoff_norms + p2.payoff_ug + p2.payoff_rule p1.payoff_total = p1.payoff_norms + p1.payoff_ug + p1.payoff_rule + 4 p2.payoff_total = p2.payoff_norms + p2.payoff_ug + p2.payoff_rule + 4 def keys_with_top_values(my_dict): return [key for (key, value) in my_dict.items() if value == max(my_dict.values())] def key_with_top_values_int(d): key = 0 for k, v in d.items(): if v > 0: key = k return int(key) def my_function(subsession): for g in subsession.get_groups(): set_payoffs(g) def get_quiz_dataDG(): return [ dict( name='DG1', solution=3, explanation="The selected answer is incorrect. The correct answer is “Person A earns 7€ and Person B " "earns 3€”. Recall that Person A receives 10€. Therefore, if Person A gives 3€ to Person B," " Person A earns (10 - 3) = 7€ and Person B earns 3€.", ), dict( name='DG2', solution=1, explanation="The selected answer is incorrect. The correct answer is “Person A earns 3€ " "and Person B earns 7€”. Recall that Person A receives 10€. " "Therefore, if Person A gives 7€ to Person B, Person A earns (10 - 7) = 3€ " "and Person B earns 7€. ", ), ] def get_quiz_dataPGG(): return [ dict( name='PGG', solution=1, explanation="The selected answer is incorrect. The correct answer is:” The amount deposited in " "the PUBLIC account is divided equally among group members regardless of their" " contributions to the PUBLIC account”. " " Since the decisions are taken simultaneously, Person A does not know the amount of money " "that other members of the group will deposit in the PUBLIC account." "The earnings of Person A depend on his decisions, but also in the decisions of other group" " members. Notice that Person A earns money by the deposits of other group members do in" " the PUBLIC account. ", ), ] def get_quiz_dataBE(): return [ dict( name='BE1', solution=2, explanation="The selected answer is incorrect. The correct answer is “7€”. Individuals " "that choose X earn 7€ regardless of the actions selected by other individuals. " "If Person A selects X, Person A, and all the individuals that selected X, " "obtain 7€. All the individuals that selected Y obtain 10€.", ), dict( name='BE2', solution=3, explanation="The selected answer is incorrect. The correct answer is “To answer" " this question, it is necessary to know the actions selected by" " other group members”. If Person A selects Y, Person A obtain " "10€ if at least one individual of the group selects X, and 0€ otherwise.", ), ] def get_quiz_dataUG(): return [ dict( name='UG1', solution=2, explanation="The selected answer is incorrect. The correct answer is “Person A earns 0€ and " "Person B earns 0€”. Person B rejected the offer. Recall that when Person B " "rejects an offer both Person A and Person B earn 0€.", ), dict( name='UG2', solution=1, explanation="The selected answer is incorrect. The correct answer is “Person A " "earns 7€ and Person B earns 3€”. Person B accepted the offer. " "Therefore, Person A earns (10 - 3) = 7€ when he gives 3€ to Person B. Person B earns 3€.", ), ] def get_quiz_dataUG_play(): return [ dict( name='UG1_payment', solution=2, explanation="The selected answer is incorrect. The correct answer is “Any of the decisions you will" " make in the role of Person A and Person B may affect your payment”. More concretely," " there is a 50% chance your payment will depend on the decision you will make in the role" " of Person A, and a 50% chance that it will depend on the decision you will make in the" " role of Person B." "Your payment in this task depends in your decisions, but also depend on chance and" " in the decisions of the participant you are matched with.", ), dict( name='UG1_play', solution=2, explanation="The selected answer is incorrect. The correct answer is “Person A earns 0€ and " "Person B earns 0€”. Person B rejected the offer. Recall that when Person B " "rejects an offer both Person A and Person B earn 0€.", ), dict( name='UG2_play', solution=1, explanation="The selected answer is incorrect. The correct answer is “Person A " "earns 7€ and Person B earns 3€”. Person B accepted the offer. " "Therefore, Person A earns (10 - 3) = 7€ when he gives 3€ to Person B. Person B earns 3€.", ), ] def get_quiz_dataDoubled(): return [ dict( name='Doubled1', solution=2, explanation="The selected answer is incorrect. The correct answer is “Person A earns 7€ and Person" " B earns 6€”. Recall that Person A receives 10€, and that the amount send by Person A" " is doubled. Therefore, if Person A gives 3€ to Person B, Person A earns (10 - 3) =" " 7€ and Person B earns (3 x 2) = 6€.", ), dict( name='Doubled2', solution=3, explanation="The selected answer is incorrect. The correct answer is “Person A earns 3€ and Person B" " earns 14€”. Recall that Person A receives 10€, and that the amount send by " "Person A is doubled. Therefore, if Person A gives 7€ to Person B, Person A" " earns (10 - 7) = 3€ and Person B earns (7 x 2) = 14€.", ), ] def get_quiz_dataHalf(): return [ dict( name='Half1', solution=2, explanation="The selected answer is incorrect. The correct answer is “Person A earns 7€ and Person B" " earns 1.50€”. Recall that Person A receives 10€, and that half the amount send " "by Person A is lost. Therefore, if Person A gives 3€ to Person B, Person A earns" " (10 - 3) = 7€ and Person B earns (3 x 1/2) = 1.50€.", ), dict( name='Half2', solution=3, explanation="The selected answer is incorrect. The correct answer is “Person A earns 3€ and Person B earns" " 3.50€”. Recall that Person A receives 10€, and that half the amount " "send by Person A is lost. Therefore, if Person A gives 3€ to Person B," " Person A earns (10 - 7) = 3€ and Person B earns (7 x 1/2) = 3.50€.", ), ] def get_quiz_dataEarnR(): return [ dict( name='EarnR1', solution=3, explanation="The selected answer is incorrect. The correct answer is “Person B completed a questionnaire" " and Person A divides the amount earned by Person B”. Person B earns 10€ by answering a " "questionnaire that lasted 30 minutes. Person A did not have the opportunity to earn any " "money. Then, Person A divides the 10€ earned by Person B between himself and Person B.", ) ] def get_quiz_dataEarnD(): return [ dict( name='EarnD1', solution=2, explanation="The selected answer is incorrect. The correct answer is “Person A " "completed a questionnaire and Person A divides the amount earned by" " Person A”. Person A earns 10€ by answering a questionnaire that" " lasted 30 minutes. Person B did not have the opportunity to earn " "any money. Then, Person A divides the 10€ he earned between himself and Person B.", ) ] def get_quiz_data_SN_payment(): return [ dict( name='payment_norms', solution=3, explanation="The selected answer is incorrect. The correct answer is “Any action you evaluate" " can be selected to determine your payment in this task”. Remember that at the" " end of the study, we will randomly select one action. For that selected action," " if your answer is exactly the same as the most selected answer of the other" " participants of this session, you will earn 8€. Therefore, any decision you" " take on this task can affect your payment. Your payment in this task " "depends in your evaluations and on chance, but also in the decisions of the" " other participants of this session. " "Your payment in this task depends in your evaluations and on chance," " but also in the decisions of the other participants of this session.", ) ] # PAGES class InstructionsUG(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG_play'] and player.participant.vars['consent1'] == 0 class Contribution1(Page): form_model = 'player' form_fields = ['contribution'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG_play'] and player.participant.vars['consent1'] == 0 class RejectionThreshold(Page): form_model = 'player' form_fields = ['rejection'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG_play'] and player.participant.vars['consent1'] == 0 class ElicitationNormsUG(Page): # which forms are needed from class player form_model = 'player' form_fields = ['UG_1', 'UG_2', 'UG_3', 'UG_4', 'UG_5', 'UG_6', 'UG_7', 'UG_8', 'UG_9', 'UG_10', 'UG_11'] list = form_fields # all 11 options @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsUG.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsDoubled(Page): # which forms are needed from class player form_model = 'player' form_fields = ['Doubled_1', 'Doubled_2', 'Doubled_3', 'Doubled_4', 'Doubled_5', 'Doubled_6', 'Doubled_7', 'Doubled_8', 'Doubled_9', 'Doubled_10', 'Doubled_11'] # all 11 options list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Doubled'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsDoubled.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsHalf(Page): # which forms are needed from class player form_model = 'player' form_fields = ['Half_1', 'Half_2', 'Half_3', 'Half_4', 'Half_5', 'Half_6', 'Half_7', 'Half_8', 'Half_9', 'Half_10', 'Half_11'] list = form_fields # all 11 options @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Half'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsHalf.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsDG(Page): # which forms are needed from class player form_model = 'player' form_fields = ['DG_1', 'DG_2', 'DG_3', 'DG_4', 'DG_5', 'DG_6', 'DG_7', 'DG_8', 'DG_9', 'DG_10', 'DG_11'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['DG'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsDG.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsEarnR(Page): # which forms are needed from class player form_model = 'player' form_fields = ['EarnR_1', 'EarnR_2', 'EarnR_3', 'EarnR_4', 'EarnR_5', 'EarnR_6', 'EarnR_7', 'EarnR_8', 'EarnR_9', 'EarnR_10', 'EarnR_11'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnR'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsEarnR.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsEarnD(Page): # which forms are needed from class player form_model = 'player' form_fields = ['EarnD_1', 'EarnD_2', 'EarnD_3', 'EarnD_4', 'EarnD_5', 'EarnD_6', 'EarnD_7', 'EarnD_8', 'EarnD_9', 'EarnD_10', 'EarnD_11'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnD'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsEarnD.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsPGG_AN1(Page): # which forms are needed from class player form_model = 'player' form_fields = ['PGG1_0', 'PGG1_2', 'PGG1_4', 'PGG1_6', 'PGG1_8', 'PGG1_10', 'PGG2_0', 'PGG2_2', 'PGG2_4', 'PGG2_6', 'PGG2_8', 'PGG2_10'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.treatment == 'A' and player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsPGG_AN1.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class ElicitationNormsPGG_AN2(Page): # which forms are needed from class player form_model = 'player' form_fields = ['PGG3_0', 'PGG3_2', 'PGG3_4', 'PGG3_6', 'PGG3_8', 'PGG3_10', 'PGG4_0', 'PGG4_2', 'PGG4_4', 'PGG4_6', 'PGG4_8', 'PGG4_10'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.treatment == 'B' and player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsPGG_AN2.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class Instructions1(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class ConsentForm(Page): # which forms are needed from class player form_model = 'player' form_fields = ['consent'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 def before_next_page(player, timeout_happened): player.participant.vars['consent1'] = player.consent class GeneralInstructionsExperiment(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class ExampleSituation(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class SituationDescriptionUG(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG'] and player.participant.vars['consent1'] == 0 class SituationDescriptionDoubled(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Doubled'] and player.participant.vars['consent1'] == 0 class SituationDescriptionHalf(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Half'] and player.participant.vars['consent1'] == 0 class SituationDescriptionDG(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['DG'] and player.participant.vars['consent1'] == 0 class SituationDescriptionEarnR(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnR'] and player.participant.vars['consent1'] == 0 class SituationDescriptionEarnD(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnD'] and player.participant.vars['consent1'] == 0 class SituationDescriptionBystander_N(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['BE'] and player.participant.vars['consent1'] == 0 class ElicitationNormsBystander_N(Page): # which forms are needed from class player form_model = 'player' form_fields = ['N_2', 'C_2', 'N_4', 'C_4', 'N_8', 'C_8', 'N_16', 'C_16'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['BE'] and player.participant.vars['consent1'] == 0 def before_next_page(player: Player, timeout_happened): for i in ElicitationNormsBystander_N.list: player.participant.vars['round'][i][player.round_number] = player.participant.vars['round'][i][ player.round_number] + 1 if eval('player.' + i) == 1: player.session.vars['responses'][i]['Very Inappropriate'] = \ player.session.vars['responses'][i]['Very Inappropriate'] + 1 elif eval('player.' + i) == 2: player.session.vars['responses'][i]['Inappropriate'] = \ player.session.vars['responses'][i]['Inappropriate'] + 1 elif eval('player.' + i) == 3: player.session.vars['responses'][i]['Rather Inappropriate'] = \ player.session.vars['responses'][i]['Rather Inappropriate'] + 1 elif eval('player.' + i) == 4: player.session.vars['responses'][i]['Rather Appropriate'] = \ player.session.vars['responses'][i]['Rather Appropriate'] + 1 elif eval('player.' + i) == 5: player.session.vars['responses'][i]['Appropriate'] = \ player.session.vars['responses'][i]['Appropriate'] + 1 else: player.session.vars['responses'][i]['Very Appropriate'] = \ player.session.vars['responses'][i]['Very Appropriate'] + 1 class SituationDescriptionPGG_AN(Page): # which forms are needed from class player form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 class InstructionsGame(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG_play'] and player.participant.vars['consent1'] == 0 class InstructionsExperiment(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class Code(Page): form_model = 'player' form_fields = ['code'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class QuestionnaireIntro(Page): # forms to retrieve individual information form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class QuestionnaireRecall(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['recall'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class QuestionnaireAltruism1(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['donation'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class QuestionnaireAltruism2(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['altruistic'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class QuestionnaireRisk(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['risk'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class QuestionnairePersonal(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['age', 'gender', 'Nationality', 'Study'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class QuestionnaireRules(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['rules'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class Page2(Page): # forms to retrieve individual information form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class Page3(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['RFT_balls_in_blue', 'RFT_balls_in_yellow'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class ResultsWaitPage(WaitPage): template_name = 'Social_Norms/MyWaitPage.html' wait_for_all_groups = True after_all_players_arrive = my_function @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class Capture(Page): form_model = 'player' form_fields = ['A', 'B', 'C', 'D'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class Results(Page): form_model = 'player' def vars_for_template(player: Player): if player.id_in_group == 1: return dict(session=player.subsession.session.vars['responses'], payment=player.subsession.session.vars['rounds_to_pay'], max=keys_with_top_values(player.subsession.session.vars['responses']['UG_2']), ms=keys_with_top_values(player.subsession.session.vars['responses']['UG_3']), rule=player.payoff_rule ) if player.id_in_group == 2: return dict(session2=player.subsession.session.vars['responses']) @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == Constants.num_rounds and player.participant.vars['consent1'] == 0 class TestInstructions(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class IntructionsTask1(Page): form_model = 'player' form_fields = ['UG1_play', 'UG2_play', 'UG1_payment'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG_play'] and player.participant.vars['consent1'] == 0 class IntructionsTask2(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == 1 and player.participant.vars['consent1'] == 0 class InstructionsNormsUG(Page): # which forms are needed from class player form_model = 'player' form_fields = ['UG1', 'UG2'] list = form_fields # all 11 options @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG'] and player.participant.vars['consent1'] == 0 class InstructionsNormsDoubled(Page): # which forms are needed from class player form_model = 'player' form_fields = ['Doubled1', 'Doubled2'] # all 11 options list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Doubled'] and player.participant.vars['consent1'] == 0 class InstructionsNormsHalf(Page): # which forms are needed from class player form_model = 'player' form_fields = ['Half1', 'Half2'] list = form_fields # all 11 options @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Half'] and player.participant.vars['consent1'] == 0 class InstructionsNormsDG(Page): # which forms are needed from class player form_model = 'player' form_fields = ['DG1', 'DG2'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['DG'] and player.participant.vars['consent1'] == 0 class InstructionsNormsBystander_N(Page): # which forms are needed from class player form_model = 'player' form_fields = ['BE1', 'BE2'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['BE'] and player.participant.vars['consent1'] == 0 class InstructionsNormsEarnR(Page): # which forms are needed from class player form_model = 'player' form_fields = ['EarnR1'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnR'] and player.participant.vars['consent1'] == 0 class InstructionsNormsEarnD(Page): # which forms are needed from class player form_model = 'player' form_fields = ['EarnD1'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnD'] and player.participant.vars['consent1'] == 0 class InstructionsNormsPGG_A(Page): # which forms are needed from class player form_model = 'player' form_fields = ['PGG'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.treatment == 'A' and player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 class InstructionsNormsPGG_B(Page): # which forms are needed from class player form_model = 'player' form_fields = ['PGG'] list = form_fields @staticmethod def is_displayed(player: Player): participant = player.participant return player.treatment == 'B' and player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 class ResultsUG(Page): form_model = 'player' form_fields = ['UG1', 'UG2'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataUG() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsDoubled(Page): form_model = 'player' form_fields = ['Doubled1', 'Doubled2'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Doubled'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataDoubled() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsHalf(Page): form_model = 'player' form_fields = ['Half1', 'Half2'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['Half'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataHalf() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsDG(Page): form_model = 'player' form_fields = ['DG1', 'DG2'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['DG'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataDG() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsBE(Page): form_model = 'player' form_fields = ['BE1', 'BE2'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['BE'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataBE() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsEarnR(Page): form_model = 'player' form_fields = ['EarnR1'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnR'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataEarnR() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsEarnD(Page): form_model = 'player' form_fields = ['EarnD1'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['EarnD'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataEarnD() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsPGG_A(Page): form_model = 'player' form_fields = ['PGG'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.treatment == 'A' and player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataPGG() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsPGG_B(Page): form_model = 'player' form_fields = ['PGG'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.treatment == 'B' and player.round_number == player.participant.vars['task_rounds']['PGG'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataPGG() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) class ResultsTask1(Page): form_model = 'player' form_fields = ['UG1_play', 'UG2_play', 'UG1_payment'] @staticmethod def is_displayed(player: Player): participant = player.participant return player.round_number == player.participant.vars['task_rounds']['UG_play'] and player.participant.vars['consent1'] == 0 @staticmethod def vars_for_template(player: Player): fields = get_quiz_dataUG_play() # we add an extra entry 'is_correct' (True/False) to each field for d in fields: d['is_correct'] = getattr(player, d['name']) == d['solution'] return dict(fields=fields, show_solutions=True) page_sequence = [ConsentForm, Code, TestInstructions, IntructionsTask1, ResultsTask1, RejectionThreshold, Contribution1, IntructionsTask2, InstructionsNormsUG, ResultsUG, ElicitationNormsUG, InstructionsNormsDoubled, ResultsDoubled, ElicitationNormsDoubled, InstructionsNormsHalf, ResultsHalf, ElicitationNormsHalf, InstructionsNormsDG, ResultsDG, ElicitationNormsDG, InstructionsNormsBystander_N, ResultsBE, ElicitationNormsBystander_N, InstructionsNormsEarnR, ResultsEarnR, ElicitationNormsEarnR, InstructionsNormsEarnD, ResultsEarnD, ElicitationNormsEarnD, InstructionsNormsPGG_A, ResultsPGG_A, ElicitationNormsPGG_AN1, InstructionsNormsPGG_B, ResultsPGG_B, ElicitationNormsPGG_AN2, Page2, Page3, QuestionnaireIntro, QuestionnaireRecall, QuestionnaireRules, QuestionnaireAltruism1, QuestionnaireAltruism2, QuestionnaireRisk, QuestionnairePersonal, ResultsWaitPage, Results]