from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'my_first_trust_game' players_per_group = 2 num_rounds = 1 factor = 3 endowment = c(100) class Subsession(BaseSubsession): pass class Group(BaseGroup): moneygiven = models.CurrencyField(choices = currency_range(c(0),c(100),c(10))) moneygivenback = models.CurrencyField() def set_payoff(self): p1,p2=self.get_players() p1.payoff = Constants.endowment - self.moneygiven + self.moneygivenback p2.payoff = Constants.factor * self.moneygiven - self.moneygivenback class Player(BasePlayer): pass