from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = '\nThis is a one-shot "Prisoner\'s Dilemma". Two players are asked separately\nwhether they want to cooperate or defect. Their choices directly determine the\npayoffs.\n' class Constants(BaseConstants): name_in_url = 'Instructions' players_per_group = 2 num_rounds = 1 betray_payoff = c(112) betrayed_payoff = c(25) both_cooperate_payoff = c(73) both_defect_payoff = c(42) expected_cooperators = 11 bonus = c(40) instructions_template = 'Instructions/instructions.html' instructions_mturk_template = 'Instructions/instructions_mturk.html' class Subsession(BaseSubsession): def Grouping_random(self): self.group_randomly() class Group(BaseGroup): def set_payoffs(self): for p in self.get_players(): p.set_payoff() class Player(BasePlayer): Prolific_ID = models.StringField(label='Please enter your Prolific ID') def other_player(self): return self.get_others_in_group()[0]