from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import numpy as np author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'Undercutting_Game' players_per_group = 2 num_rounds = 1 Gain_Matrix_p2=np.array( [ [16,5,15, 15,15,15,15], [25, 15, 5, 15, 15, 15, 15], [15, 25, 15, 5, 15, 15, 15], [15, 15, 25, 15, 5, 5, 5], [15, 15, 15, 25, 15, 15, 15], [15, 15, 15, 25, 15, 15, 15], [4, 15, 15, 25, 15, 15, 4]] ) Gain_Matrix_p1=np.transpose(Gain_Matrix_p2) s_payoff=15 class Subsession(BaseSubsession): pass class Group(BaseGroup): position1=models.IntegerField() position2=models.IntegerField() def set_payoffs(self): for p in self.get_players(): p.payoff=p.gain class Player(BasePlayer): Choice=models.IntegerField( min=1, max=7, label="", ) Payoff_choice = models.IntegerField( choices=[[1, 'Sure Payoff'], [0, 'Payoff of Task 1']], label=" Do you want the payoff of the task 1 or a sure payoff of 15 points ?", widget=widgets.RadioSelect ) gain=models.FloatField() gain1=models.IntegerField() gain2=models.IntegerField() trole = models.IntegerField() def other_player(self): return self.get_others_in_group()[0]