from otree.api import * doc = """ Your app description """ class Constants(BaseConstants): NAME_IN_URL = 'payofftest' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 cooperate_amount = 4 defect_amount = 3 cooperate_defect = 2 defect_cooperate = 5 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): pass def other_player(self): return self.get_others_in_group()[0] def set_payoff(self): points_matrix = {'Cooperate': {'Cooperate': Constants.cooperate_amount, 'Defect': Constants.cooperate_defect}, 'Defect': {'Cooperate': Constants.defect_cooperate, 'Defect': Constants.defect_amount}} self.payoff = (points_matrix[self.decision][self.other_player().decision]) class MyPage(Page): pass class ResultsWaitPage(WaitPage): pass class Results(Page): pass page_sequence = [MyPage, ResultsWaitPage, Results]