from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) doc = """ This is a one-shot "Prisoner's Dilemma". Two players are asked separately whether they want to cooperate or defect. Their choices directly determine the payoffs. """ class Constants(BaseConstants): name_in_url = 'decomposedinfo1' players_per_group = 2 num_rounds = 1 instructions_template = 'decomposedinfo1/instructions.html' my_A_payoff = c(30) my_B_payoff = c(40) my_C_payoff = c(50) my_D_payoff = c(60) my_E_payoff = c(70) other_A_payoff = c(80) other_B_payoff = c(60) other_C_payoff = c(40) other_D_payoff = c(20) other_E_payoff = c(0) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): decision = models.StringField( choices=[['A', 'A'], ['B', 'B'], ['C', 'C'], ['D', 'D'], ['E', 'E']], doc="""This player's decision""", widget=widgets.RadioSelect, ) def other_player(self): return self.get_others_in_group()[0] def set_payoff(self): self.payoff = 0