# common.py from otree.api import Page, ExtraModel from otree.api import BaseConstants from otree.api import models, widgets import json import random # %% Constants class CommonConstants(BaseConstants): Instructions_general_path = "_templates/global/Instructions.html" Instructions_practice_1 = "_templates/global/Instructions_Practice_1.html" Part_II_Instructions_template = "_templates/global/Part_II_Instructions_template.html" Instructions_pgg = "_templates/global/Instructions_pgg.html" Round_length = 6000 # legacy; use Economy_round_length / Practice_round_length below Economy_round_length = 45 # seconds per quiz part in economy rounds Practice_round_length = 90 # seconds per quiz part in practice rounds Submit_freeze_duration = 5 # seconds page is frozen before first answer can be confirmed Interstitial_length = 3 # seconds for interstitial auto-advance Timer_text = "Time left to complete this part:" Economy_num_rounds = 10 Completion_fee = 10 # TODO: adjust completion fee Bonus_max = 20 # TODO: adjust maximum bonus Bonus_max_practice = 1.00 Practice_ECs = 5 RavensQuiz_template_path = "_templates/global/RavensQuiz.html" AnalogyQuiz_template_path = "_templates/global/AnalogyQuiz.html" MathQuiz_template_path = "_templates/global/MathQuiz.html" Interstitial_template_path = "_templates/global/Interstitial.html" # \u2500\u2500 Economy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 Economy_pie = 500 # fixed pie size (ECs) competed over each round Welfare_check = 50 # flat bonus added to weighted score in Welfare State PGG_Commons = 300 # starting tokens in the common pool each round PGG_investible = 100 # tokens each player can invest in the common pool each round Pgg_lower_bound = 200 Pgg_upper_bound = 400 PGG_Guess_ECs = 500 # \u2500\u2500 Multipliers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 M_high = 7 # high-performer (Excessive Meritocracy / Aristocracy) M_medium = 5 # medium-performer (all treatments as base) M_low = 3 # low-performer (Excessive Meritocracy / Aristocracy) # \u2500\u2500 Treatment names \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 TREATMENTS = ['Perfect_Meritocracy', 'Excessive_Meritocracy', 'Welfare_State', 'Aristocracy'] # \u2500\u2500 Treatment explanation texts (shown on Part_II_Instructions) \u2500\u2500\u2500\u2500 Explanation_Perfect_Meritocracy = ( '
You have been placed in a group with two other participants. The three of you form a Group.
' 'Each round, all three members compete over a pot of 500 ECs. ' 'Your share of the pot depends on how well you perform relative to the others in your group.
' 'All three members of your Group are treated identically — ' 'your share is determined purely by how many questions you answer correctly compared to the other two members.
' ) Explanation_Excessive_Meritocracy = ( 'You have been placed in a group with two other participants. The three of you form a Group.
' 'Each round, all three members compete over a pot of 500 ECs. ' 'Your share depends on your score and your multiplier.
' 'Multipliers were assigned based on relative performance in the practice rounds: ' 'the top performer received ×7, ' 'the middle performer ×5, ' 'and the bottom performer ×3.
' 'Your personal multiplier is shown below.
' ) Explanation_Welfare_State = ( 'You have been placed in a group with two other participants. The three of you form a Group.
' 'Each round, all three members compete over a pot of 500 ECs. ' 'Your share depends on your score.
' 'The score is calculated as performance in the round plus the average performance of the three players.' ) Explanation_Aristocracy = ( 'You have been placed in a group with two other participants. The three of you form a Group.
' 'Each round, all three members compete over a pot of 500 ECs. ' 'Your share depends on your score and your multiplier.
' 'Multipliers were assigned randomly among the three members of your Group: ' 'one member received ×7, one ×5, and one ×3.
' 'Your personal multiplier is shown below.
' ) Welfare_check_text = '