from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import statistics from random import * doc = """ Survey DL """ class Constants(BaseConstants): name_in_url = 'survey_dynamicL' players_per_group = None num_rounds = 1 ContributionChoices = [ [1, 'Not Applicable'], [2, 'Not important'], [3, 'Somewhat important'], [4, 'Important'], [5, 'Very Important'], ] ContributionFeel = [ [1, 'Strategic Substitutes'], [2, '2'], [3, '3'], [4, '4'], [5, 'Strategic Complements'], ] GroupObservations = [ [1, 'Group or own investments in previous rounds'], [2, 'Monetary self-interest'], [3, 'Fairness consideration'], [4, 'Achievement of threshold (90 Cashcoins)'], [5, 'Signal to other players'], [6, 'I was this player'], ] ContributionDescr = [ [1, 'Selfish'], [2, '2'], [3, '3'], [4, '4'], [5, 'Coopeartive'], [6, 'I was this player'], ] AgreementChoices = [ [1, 'Disagree'], [2, 'Somewhat Disagree'], [3, 'Indifferent'], [4, 'Somewhat Agree'], [5, 'Agree'], ] PledgeDescr = [ [1, 'Disagree'], [2, 'Somewhat Disagree'], [3, 'Indifferent'], [4, 'Somewhat Agree'], [5, 'Agree'], [6, 'I was this player'], ] RiskLossChoice = [ [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], ] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField(label='Please enter your age:') gender = models.StringField( label='Please choose your gender:', choices=["Male", "Female", "Other", "Prefer not to say"] ) iban = models.CharField(label='Please enter your IBAN Bank Account number (e.g. AB12 ABCD 0123 4567 89):') iban2 = models.CharField(label='Please re-enter your IBAN Bank Account number:') participantcode = models.CharField(label='Please enter your Participant Code:') Investments = models.IntegerField( label="Group or own investments in previous rounds", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) SelfInterest = models.IntegerField( label="Monetary self-interest", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Fairness = models.IntegerField( label="Fairness consideration", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) ThresholdAchievement = models.IntegerField( label="Achievement of threshold (90 Cashcoins)", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Signal = models.IntegerField( label="Signal to other players", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) ContriFeel = models.IntegerField( label="Effect of other players' contributions", widget=widgets.RadioSelect, choices=Constants.ContributionFeel, ) SelfInterest1 = models.IntegerField( label="Monetary self-interest", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Fairness1 = models.IntegerField( label="Fairness consideration", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) ThresholdAchievement1 = models.IntegerField( label="Achievement of threshold (90 Cashcoins)", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Signal1 = models.IntegerField( label="Signal to other players", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Investments9 = models.IntegerField( label="Group or own investments in previous rounds", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) SelfInterest9 = models.IntegerField( label="Monetary self-interest", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Fairness9 = models.IntegerField( label="Fairness consideration", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) ThresholdAchievement9 = models.IntegerField( label="Achievement of threshold (90 Cashcoins)", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) Signal9 = models.IntegerField( label="Signal to other players", widget=widgets.RadioSelect, choices=Constants.ContributionChoices, ) redo = models.CharField(label='If you were to play the game again, what would you do differently?') Player1 = models.IntegerField( label="Player 1", widget=widgets.RadioSelect, choices=Constants.GroupObservations, ) Player2 = models.IntegerField( label="Player 2", widget=widgets.RadioSelect, choices=Constants.GroupObservations, ) Player3 = models.IntegerField( label="Player 3", widget=widgets.RadioSelect, choices=Constants.GroupObservations, ) Player4 = models.IntegerField( label="Player 4", widget=widgets.RadioSelect, choices=Constants.GroupObservations, ) Player5 = models.IntegerField( label="Player 5", widget=widgets.RadioSelect, choices=Constants.GroupObservations, ) Player1_1 = models.IntegerField( label="Player 1", widget=widgets.RadioSelect, choices=Constants.ContributionDescr, ) Player2_1 = models.IntegerField( label="Player 2", widget=widgets.RadioSelect, choices=Constants.ContributionDescr, ) Player3_1 = models.IntegerField( label="Player 3", widget=widgets.RadioSelect, choices=Constants.ContributionDescr, ) Player4_1 = models.IntegerField( label="Player 4", widget=widgets.RadioSelect, choices=Constants.ContributionDescr, ) Player5_1 = models.IntegerField( label="Player 5", widget=widgets.RadioSelect, choices=Constants.ContributionDescr, ) Player1_2 = models.IntegerField( label="Player 1", widget=widgets.RadioSelect, choices=Constants.PledgeDescr, ) Player2_2 = models.IntegerField( label="Player 2", widget=widgets.RadioSelect, choices=Constants.PledgeDescr, ) Player3_2 = models.IntegerField( label="Player 3", widget=widgets.RadioSelect, choices=Constants.PledgeDescr, ) Player4_2 = models.IntegerField( label="Player 4", widget=widgets.RadioSelect, choices=Constants.PledgeDescr, ) Player5_2 = models.IntegerField( label="Player 5", widget=widgets.RadioSelect, choices=Constants.PledgeDescr, ) LeaderPledge = models.IntegerField( label="Having a leader and pledges helped coordinate contributions to the Climate Pot", widget=widgets.RadioSelect, choices=Constants.AgreementChoices, ) LeaderPledge1 = models.IntegerField( label="Having a leader and pledges helped reach the threshold level", widget=widgets.RadioSelect, choices=Constants.AgreementChoices, ) ClimMitig = models.IntegerField( label="Mitigating climate change is one of the most important societal issues", widget=widgets.RadioSelect, choices=Constants.AgreementChoices, ) EarlyMitig = models.IntegerField( label="To reach climate targets, it is important to reduce emissions immediately", widget=widgets.RadioSelect, choices=Constants.AgreementChoices, ) GlobalMitig = models.IntegerField( label="To reach climate targets, it is important that everyone contributes to reducing emissions", widget=widgets.RadioSelect, choices=Constants.AgreementChoices, ) LeaderMitig = models.IntegerField( label="To reach climate targets, it is important that a climate leader takes the initiative", widget=widgets.RadioSelect, choices=Constants.AgreementChoices, ) riskpref = models.IntegerField( label="How willing are you to take risks, in general?", widget=widgets.RadioSelectHorizontal, choices=Constants.RiskLossChoice, ) losspref = models.IntegerField( label="How willing are you to incur losses, in the possibility of a larger gain?", widget=widgets.RadioSelectHorizontal, choices=Constants.RiskLossChoice, ) lottery = models.IntegerField(label='Y should be at least ___ EUROS to make the lottery acceptable:')