from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'tutorial' players_per_group = 3 num_rounds = 1 endowment = 200 cost_effort = 1 cost_sabotage = 1 donation_base = 10 donation_fraction = 1 externality_effort = 1 / 6 externatlity_sabotage = 1 / 6 prize = 200 instructions_template = "tutorial/InstructionsOverview.html" contestants_pool = players_per_group entering_probability = 1 / 4 # Set this to either 3/4 or 1/4, otherwise functionality will not work everywhere! currency_name = 'points' groupSize_template = "tutorial/GroupSizeProbabilities.html" timeout = 120000 # 120'000= 2minutes for JavaScript in html pages timeoutShort = 100000 # 100 seconds for shorter pages timeout2 = 150 # for pages.py file, 30 seconds after the pop-up window = 2.5minutes timeout2Short = 120000 # 2minuts timeoutText = 30 # for text in JavaScript in html pages should be set as the difference of timeout and timeout2 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Values Tutorial effortTut1 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut1PC = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut2PC = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut2PC = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut3P2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut3P2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut3P3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut3P3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut3P4 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut3P4 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut3P5 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut3P5 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4_1 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4_1 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4_2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4_2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4_3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4_3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4_4 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4_4 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4_5 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4_5 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4P2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4P2 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4P3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4P3 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4P4 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4P4 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) effortTut4P5 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) sabotageTut4P5 = models.IntegerField(widget=widgets.Slider, max=Constants.endowment, min=0) # Fields in the calculator effort_calc_try = models.IntegerField() sabotage_calc_try = models.IntegerField() effort_opponent_calc_try = models.IntegerField() sabotage_opponent_calc_try = models.IntegerField() effort_p1_calc_try = models.IntegerField() sabotage_p1_calc_try = models.IntegerField() effort_p2_calc_try = models.IntegerField() sabotage_p2_calc_try = models.IntegerField() effort_p3_calc_try = models.IntegerField() sabotage_p3_calc_try = models.IntegerField() effort_p4_calc_try = models.IntegerField() sabotage_p4_calc_try = models.IntegerField() effort_p5_calc_try = models.IntegerField() sabotage_p5_calc_try = models.IntegerField() clicksEffort_calc_try = models.IntegerField() clicksSabotage_calc_try = models.IntegerField() clicksOpponentEffort_calc_try = models.IntegerField() clicksOpponentSabotage_calc_try = models.IntegerField() clicksEffort_calc_advanced_try = models.IntegerField() clicksSabotage_calc_advanced_try = models.IntegerField() clicksOpponentEffort_calc_advanced_try = models.IntegerField() clicksOpponentSabotage_calc_advanced_try = models.IntegerField() # Controlquestions formfields q1 = models.IntegerField(label="Q1: How many participants will be in your group, including you?", choices=[1, 2, 3, 4, 5], widget=widgets.RadioSelect) q2 = models.StringField(label="Q2: Provided that you are active, how can you increase your probability to win?", choices=["Increase my performance and reduce the other active group members' performances", "I can't", "Increase the other active group members' performances"], widget=widgets.RadioSelect) q3 = models.StringField(label="Q3: What can you do with Option A?", choices=["Increase my performance", "Increase the other active group members' performances", "Decrease the other active group members' performances"], widget=widgets.RadioSelect) q4 = models.StringField(label="Q4: What can you do with Option B?", choices=["Decrease my performance", "Increase the other active group members' " "performances", "Decrease all other active group members' performances simultaneously", "Decrease the performance of another active group member of my choice"], widget=widgets.RadioSelect) q5 = models.StringField(label="Q5: How can you increase the donations?", choices=["Increase my performance (by investing in Option A)", "Decrease my performance (by investing less in Option A)", ], widget=widgets.RadioSelect) q6 = models.StringField(label="Q6: How can you decrease the donations?", choices=["Increase my performance (by investing in Option A)", "Decrease the other active group members' performances (by investing in Option B)", ], widget=widgets.RadioSelect) q7 = models.StringField(label="Q7: Suppose that you are active and that a round was selected for payment. " "Who is affected by your decisions?", choices=["Me and the charity", "Me, the other active group members of my group, and the charity", "Everyone of my group and the charity"], widget=widgets.RadioSelect) q8 = models.StringField(label="Q8: How many group members are active in one round?", choices=["1", "3", "This is determined randomly in every round", "This is determined randomly in the first round and stays the same until the " "end of the experiment"], widget=widgets.RadioSelect) q9 = models.StringField(label="Q9: What happens if only one group member becomes active?", choices=["This group member wins the 200-point prize independently of his/her choices", "There will never be just one active person", "There is a 50% chance that this persons wins the 200-point prize"], widget=widgets.RadioSelect) q10 = models.StringField(label="Q10: In each round, you receive a start balance of 200 points. " "What happens with the points that you do not invest in Option A or Option B?", choices=["These points are destroyed and will not be added to my payoff of this round", "I can keep the points and they will be added to my payoff of this round", ], widget=widgets.RadioSelect)