from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Corey Scheinfeld / Modified by Marco Acosta' doc = """ Stag Hunt """ class Constants(BaseConstants): name_in_url = 'staghunt3' players_per_group = 2 num_rounds = 1 instructions_template = 'staghunt2/instructions.html' class Subsession(BaseSubsession): def creating_session(subsession): subsession.group_randomly() class Group(BaseGroup): def set_payoffs(self): group = self.get_players() player1 = group[0] player2 = group[1] player1.partner_choice = player2.choice player2.partner_choice = player1.choice if player1.choice == True and player2.choice == True: player1.payoff = 95 player2.payoff = 95 if player1.choice == True and player2.choice == False: player1.payoff = 40 player2.payoff = 85 if player1.choice == False and player2.choice == False: player1.payoff = 80 player2.payoff = 80 if player1.choice == False and player2.choice == True: player1.payoff = 85 player2.payoff = 40 class Player(BasePlayer): choice = models.BooleanField() partner_choice = models.BooleanField()