from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = '\nOne player decides how to divide a certain amount between himself and the other\nplayer.\n\nSee: Kahneman, Daniel, Jack L. Knetsch, and Richard H. Thaler. "Fairness\nand the assumptions of economics." Journal of business (1986):\nS285-S300.\n\n' class Constants(BaseConstants): name_in_url = 'dictator_emc' players_per_group = None num_rounds = 1 endowment = c(50) instructions_template = 'dictator_emc/instructions.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): sent = models.CurrencyField(label='The preferred amount the sender decides to send to the receiver', max=Constants.endowment, min=0) consent = models.IntegerField(choices=[[1, 'Agree'], [0, 'Disagree']], initial=1, label='Do you agree to participate in the survey?', widget=widgets.RadioSelect) def set_payoff(self): self.payoff = Constants.endowment - self.sent