from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Santiago Neira Hernández' doc = """ Third Party Punisher 0 """ class Constants(BaseConstants): name_in_url = 'third_party_null' players_per_group = 3 num_rounds = 10 introGenA = 'third_party_null/instructionsGeneralA.html' introGenB = 'third_party_null/instructionsGeneralB.html' introGenC = 'third_party_null/instructionsGeneralC.html' introEspA = 'third_party_null/instructionsEspecificA.html' introEspB = 'third_party_null/instructionsEspecificB.html' introEspC = 'third_party_null/instructionsEspecificC.html' PcProdA='third_party_null/PcProcedureA.html' PcProdB='third_party_null/PcProcedureB.html' PcProdC='third_party_null/PcProcedureC.html' endowmentA = c(100) endowmentC = c(50) class Subsession(BaseSubsession): def creating_session(self): self.group_randomly(fixed_id_in_group=True) if self.round_number == 1: paying_round = random.randint(1, Constants.num_rounds) self.session.vars['paying_round'] = paying_round class Group(BaseGroup): sent_amount = models.CurrencyField( choices=[0,10,20,30,40,50] ) expectation_sent= models.CurrencyField( label= "¿Cuántos puntos cree que el participante A le dará a usted?", choices=[0,10,20,30,40,50] ) ## Dummy variables for player choices in rounds choice_sent=models.CurrencyField() choice_expected_return=models.CurrencyField() expectation_social_norm_s1_B=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) expectation_social_norm_s1_C=models.IntegerField( label="", choices=[ [0,"Muy socialmente inapropiada"], [1,"Algo socialmente inapropiada"], [2, "Algo socialmente apropiada"], [3, "Muy socialmente apropiada"] ], widget=widgets.RadioSelect, ) class Player(BasePlayer): survey_1 = models.IntegerField() survey_2 = models.IntegerField() survey_3 = models.IntegerField() survey_4 = models.IntegerField() survey_5 = models.IntegerField() survey_6 = models.IntegerField() survey_7=models.IntegerField() survey_8= models.IntegerField() q1=models.IntegerField(label="") q2=models.IntegerField(choices=[[0,"Masculino"],[1,"Femenino"]], widget=widgets.RadioSelect) q3=models.IntegerField(label="") q4=models.StringField(label="") q5=models.IntegerField(choices=[ [0,"Pregrado"], [1,"Posgrado"], ], widget=widgets.RadioSelect ) q6=models.IntegerField(label="") q7=models.IntegerField(choices=[[0,"Sí"],[1,"No"]], widget=widgets.RadioSelect) q8=models.IntegerField(choices=[[0,"Sí"],[1,"No"]], widget=widgets.RadioSelect) q9=models.IntegerField(min=0, max=100) q10=models.IntegerField(label="") q11=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q12=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q13=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q14=models.IntegerField(choices=[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5,"5"],[6,"6"],[7,"7"],[8,"8"],[9,"9"],[10,"10"]], widget=widgets.RadioSelectHorizontal) q15=models.IntegerField(choices=[[0,"1"],[1,"2"],[2,"3"],[3,"4"],[4,"5"],[5,"6"],[6,"No sabe/No Responde"]], widget=widgets.RadioSelect)