from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random author = 'Timo Promann' doc = """ This is a one-stage individual decision game. """ class Constants(BaseConstants): name_in_url = 'mastergame_individuals' players_per_group = None num_rounds = 1 minrandom = 1 maxrandom = 6 stakes = c(1) not_correct_report = c(0) coef = 0.2 base_payoff = c(1) payoffs = [0.2, 0.4, 0.6, 0.8, 1, 0] PayoffTable_template = 'mastergame_individuals/PayoffTable.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): honest_report = models.BooleanField() prolificID = models.StringField() numberreport = models.IntegerField(min=1, max=6, doc="""The number, you chose to report""") randomvideo = models.IntegerField(min=Constants.minrandom, max=Constants.maxrandom) def set_payoff(self): if self.numberreport == 6: self.payoff = c(0) else: self.payoff = self.numberreport * Constants.coef consent = models.StringField(widget=widgets.CheckboxInput()) age = models.IntegerField() gender = models.StringField(choices=['Female', 'Male', 'Divers'], widget=widgets.RadioSelectHorizontal) patience = models.IntegerField(widget=widgets.Slider(), min=0, max=10) answer_to_question1 = models.StringField(choices=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], widget=widgets.RadioSelectHorizontal) answer_to_question2 = models.StringField(choices=['Dirigenten-Session bei Nico', 'Physiotherapie bei Babette'], widget=widgets.RadioSelectHorizontal) answer_to_question3 = models.StringField(choices=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], widget=widgets.RadioSelectHorizontal) answer_to_question4 = models.StringField(choices=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], widget=widgets.RadioSelectHorizontal) answer_to_question5 = models.StringField(choices=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], widget=widgets.RadioSelectHorizontal) answer_to_question6 = models.StringField(choices=['1', '11'], widget=widgets.RadioSelectHorizontal) is_not_correct = models.BooleanField() is_not_correct2 = models.BooleanField() def check_correct(self): self.is_not_correct = (self.answer_to_question1 != '4') def check_correct(self): self.is_not_correct = (self.answer_to_question2 != 'Physiothreapie bei Babette') def check_correct(self): self.is_not_correct = (self.answer_to_question3 != '8') def check_correct(self): self.is_not_correct = (self.answer_to_question4 != '7') def check_correct(self): self.is_not_correct = (self.answer_to_question5 != '7') def check_correct(self): self.is_not_correct = (self.answer_to_question6 != '1')