from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Michael Collins' doc = """ This programe is the first version of the development for the multi-arm Trust Game """ class Constants(BaseConstants): name_in_url = 'MATG_v2' players_per_group = None num_rounds = 120 endowment = c(40) multiplication_factor = 4.0 class Subsession(BaseSubsession): def before_session_starts(self): #self.trust_skip1 = 1 #Here we add the noise the interaction schedule of each of the confederate agents schedule_noise=[-1,0,1] #Here we give each confederate agetn their interaction schedule #how many rounds the participants will schedule_list=[1,3,6] random.shuffle(schedule_list) trustee1_schedule=schedule_list[0] self.session.vars['trustee1_schedule']=trustee1_schedule trustee2_schedule=schedule_list[1] self.session.vars['trustee2_schedule']=trustee2_schedule trustee3_schedule=schedule_list[2] self.session.vars['trustee3_schedule']=trustee3_schedule #trustee4_schedule=schedule_list[3] #self.session.vars['trustee4_schedule']=trustee4_schedule class Group(BaseGroup): pass class Player(BasePlayer): sent_amount1 = models.FloatField(min=0, max=Constants.endowment ) sent_amount2 = models.FloatField(min=0, max=Constants.endowment ) sent_amount3 = models.FloatField(min=0, max=Constants.endowment ) Time_Contribute = models.FloatField() Time_Results = models.FloatField() Turk_ID = models.StringField() trusteeSent1 =models.FloatField() trusteeSent2 =models.FloatField() trusteeSent3 =models.FloatField() trustorpayoff=models.FloatField() ##################################################### rounds = models.FloatField() seed1 = models.FloatField() seed2 = models.FloatField() seed3 = models.FloatField() seed1_p2 = models.FloatField() seed2_p2 = models.FloatField() seed3_p2 = models.FloatField() ######################################################## t1_send = models.FloatField() t2_send = models.FloatField() t3_send = models.FloatField() ######################################################## trustor_total = models.FloatField() kept_currency = models.CurrencyField() ######################################################## skip_trustee1=models.FloatField() skip_trustee2=models.FloatField() skip_trustee3=models.FloatField() ########################################################## recieved_trustee1=models.FloatField() recieved_trustee2=models.FloatField() recieved_trustee3=models.FloatField() ########################################################## trustee1_schedule=models.FloatField() trustee2_schedule=models.FloatField() trustee3_schedule=models.FloatField() #-------------------------------------------------- trustee1_schedule_n=models.FloatField() trustee2_schedule_n=models.FloatField() trustee3_schedule_n=models.FloatField() ########################################################### trustee1_currency = models.FloatField() trustee2_currency = models.FloatField() trustee3_currency = models.FloatField() trustee_total_currency = models.FloatField() cummulative_currency_payoff = models.FloatField() Points_Currency = models.FloatField() ########################################################## trustee_total = models.FloatField() trustorpayoff = models.FloatField() Cummulative_Payoff = models.FloatField() ########################################################### Trait_q1 = models.CharField(verbose_name = "I generally have faith in humanity.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q2 = models.CharField(verbose_name = "I feel that people are generally reliable.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q3 = models.CharField(verbose_name = "I generally trust other people unless they give me a reason not to.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q4 = models.CharField(verbose_name = "Most people are basically honest.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q5 = models.CharField(verbose_name = "Most people are trustworthy.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q6 = models.CharField(verbose_name = "Most people are basically good and kind.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q7 = models.CharField(verbose_name = "Most people are trustful of others.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q8 = models.CharField(verbose_name = "I am trustful.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q9 = models.CharField(verbose_name = "Most people will respond in kind when they are trusted by others.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q10 = models.CharField(verbose_name = "Hypocrisy is on the increase in our society.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q11 = models.CharField(verbose_name = "One is better off being cautious when dealing with strangers until they have provided evidence that they are trustworthy.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q12 = models.CharField(verbose_name = "Those devoted to unselfish causes are often exploited by others.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q13 = models.CharField(verbose_name = "Fear and social disgrace or punishment rather than conscience prevents most people from breaking the law.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q14 = models.CharField(verbose_name = "Most experts can be relied upon to tell the truth about the limits of their knowledge.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q15 = models.CharField(verbose_name = "Most people tell a lie when they can benefit by doing so. ", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q16 = models.CharField(verbose_name = "The judiciary is a place where we can all get unbiased treatment.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q17 = models.CharField(verbose_name = "Most people answer public opinion polls honestly.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q18 = models.CharField(verbose_name = "Most repairmen will not overcharge, even if they think you are ignorant of their specialty", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q19 = models.CharField(verbose_name = "Most people are primarily interested in their own welfare.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q20 = models.CharField(verbose_name = "Most students in school would not cheat even if they were sure they could get away with it.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q21 = models.CharField(verbose_name = "Most people can be counted on to do what they say they will do.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q22 = models.CharField(verbose_name = "Most salesmen are honest in describing their products.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q23 = models.CharField(verbose_name = "Most elected officials are really sincere in their campaign promises.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) Trait_q24 = models.CharField(verbose_name = "In these competitive times one has to be alert or someone is likely to take advantage of you.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) #---------------------------------------------------------------------------------------------- State_q1_Player_1 = models.CharField(verbose_name = "I feel safe to take risks in this game knowing that Receiver Green would not take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q2_Player_1 = models.CharField(verbose_name = "Receiver Green would not willingly undermine my earnings in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q3_Player_1 = models.CharField(verbose_name = "Receiver Green behaves consistently.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q4_Player_1 = models.CharField(verbose_name = "I believe that Receiver Green wants to help me to make a good amount of payoff in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q5_Player_1 = models.CharField(verbose_name = "Receiver Green can be trusted.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q6_Player_1 = models.CharField(verbose_name = "Receiver Green is trying to take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q7_Player_1 = models.CharField(verbose_name = "I feel that Receiver Green is competent.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q8_Player_1 = models.CharField(verbose_name = "Receiver Green tries to make me lose in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q9_Player_1 = models.CharField(verbose_name = "I believe that Receiver Green is fair.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q10_Player_1 = models.CharField(verbose_name = "I would not let Receiver Green have any influence over my payoff. ", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q11_Player_1 = models.CharField(verbose_name = "I would be willing to let Receiver Green have complete control over the outcomes of this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q12_Player_1 = models.CharField(verbose_name = "I understand the reasoning behind Receiver Green moves.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q13_Player_1 = models.CharField(verbose_name = "I know in advance what moves Receiver Green will make.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q14_Player_1 = models.CharField(verbose_name = "I like playing with Receiver Green in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) #--------------------------------------------------------------------------------- # Player 2 Variables State_q1_Player_2 = models.CharField(verbose_name = "I feel safe to take risks in this game knowing that Receiver Blue would not take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q2_Player_2 = models.CharField(verbose_name = "Receiver Blue would not willingly undermine my earnings in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q3_Player_2 = models.CharField(verbose_name = "Receiver Blue behaves consistently.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q4_Player_2 = models.CharField(verbose_name = "I believe that Receiver Blue wants to help me to make a good amount of payoff in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q5_Player_2 = models.CharField(verbose_name = "Receiver Blue can be trusted.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q6_Player_2 = models.CharField(verbose_name = "Receiver Blue is trying to take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q7_Player_2 = models.CharField(verbose_name = "I feel that Receiver Blue is competent.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q8_Player_2 = models.CharField(verbose_name = "Receiver Blue tries to make me lose in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q9_Player_2 = models.CharField(verbose_name = "I believe that Receiver Blue is fair.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q10_Player_2 = models.CharField(verbose_name = "I would not let Receiver Blue have any influence over my payoff. ", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q11_Player_2 = models.CharField(verbose_name = "I would be willing to let Receiver Blue have complete control over the outcomes of this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q12_Player_2 = models.CharField(verbose_name = "I understand the reasoning behind Receiver Blue moves.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q13_Player_2 = models.CharField(verbose_name = "I know in advance what moves Receiver Blue will make.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q14_Player_2 = models.CharField(verbose_name = "I like playing with Receiver Blue in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) #--------------------------------------------------------------------------------- # Player 3 Variables State_q1_Player_3 = models.CharField(verbose_name = "I feel safe to take risks in this game knowing that Receiver Red would not take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q2_Player_3 = models.CharField(verbose_name = "Receiver Red would not willingly undermine my earnings in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q3_Player_3 = models.CharField(verbose_name = "Receiver Red behaves consistently.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q4_Player_3 = models.CharField(verbose_name = "I believe that Receiver Red wants to help me to make a good amount of payoff in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q5_Player_3 = models.CharField(verbose_name = "Receiver Red can be trusted.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q6_Player_3 = models.CharField(verbose_name = "Receiver Red is trying to take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q7_Player_3 = models.CharField(verbose_name = "I feel that Receiver Red is competent.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q8_Player_3 = models.CharField(verbose_name = "Receiver Red tries to make me lose in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q9_Player_3 = models.CharField(verbose_name = "I believe that Receiver Red is fair.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q10_Player_3 = models.CharField(verbose_name = "I would not let Receiver Red have any influence over my payoff. ", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q11_Player_3 = models.CharField(verbose_name = "I would be willing to let Receiver Red have complete control over the outcomes of this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q12_Player_3 = models.CharField(verbose_name = "I understand the reasoning behind Receiver Red moves.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q13_Player_3 = models.CharField(verbose_name = "I know in advance what moves Receiver Red will make.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q14_Player_3 = models.CharField(verbose_name = "I like playing with Receiver Red in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) #--------------------------------------------------------------------------------- # Player 4 Variables State_q1_Player_4 = models.CharField(verbose_name = "I feel safe to take risks in this game knowing that Receiver 4 would not take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q2_Player_4 = models.CharField(verbose_name = "Receiver 4 would not willingly undermine my earnings in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q3_Player_4 = models.CharField(verbose_name = "Receiver 4 behaves consistently.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q4_Player_4 = models.CharField(verbose_name = "I believe that Receiver 4 wants to help me to make a good amount of payoff in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q5_Player_4 = models.CharField(verbose_name = "Receiver 4 can be trusted.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q6_Player_4 = models.CharField(verbose_name = "Receiver 4 is trying to take advantage of me.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q7_Player_4 = models.CharField(verbose_name = "I feel that Receiver 4 is competent.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q8_Player_4 = models.CharField(verbose_name = "Receiver 4 tries to make me lose in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q9_Player_4 = models.CharField(verbose_name = "I believe that Receiver 4 is fair.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q10_Player_4 = models.CharField(verbose_name = "I would not let Receiver 4 have any influence over my payoff. ", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q11_Player_4 = models.CharField(verbose_name = "I would be willing to let Receiver 4 have complete control over the outcomes of this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q12_Player_4 = models.CharField(verbose_name = "I understand the reasoning behind Receiver 4 moves.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q13_Player_4 = models.CharField(verbose_name = "I know in advance what moves Receiver 4 will make.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) State_q14_Player_4 = models.CharField(verbose_name = "I like playing with Receiver 4 in this game.", initial=None, choices=["Disagree very much", "Disagree slightly", "Neither agree nor disagree", "Agree slightly", "Agree very much"], widget=widgets.RadioSelectHorizontal()) def set_payoffs(self): self.rounds = self.subsession.round_number #---------------------------------------------------------------------------------- # Here we record the schedule of the different confederate arms self.trustee1_schedule=self.session.vars['trustee1_schedule'] self.trustee2_schedule=self.session.vars['trustee2_schedule'] self.trustee3_schedule=self.session.vars['trustee3_schedule'] #--------------------------------------------------------------------------------- self.Points_Currency= round(.05, 2) #--------------------------------------------------------------------------------- #Define Schedule based noise if(self.trustee1_schedule) == 1: self.trustee1_schedule_n=1 elif(self.rounds % self.trustee1_schedule == 0 and self.trustee1_schedule != 1) or self.rounds == 1: self.trustee1_schedule_n=self.trustee1_schedule + random.choice([-1,0,1]) else: self.trustee1_schedule_n=self.in_round(self.round_number-1).trustee1_schedule_n if(self.trustee2_schedule)==1: self.trustee2_schedule_n=1 elif (self.rounds % self.trustee2_schedule == 0 and self.trustee2_schedule != 1) or self.rounds == 1: self.trustee2_schedule_n=self.trustee2_schedule + random.choice([-1,0,1]) else: self.trustee2_schedule_n=self.in_round(self.round_number-1).trustee2_schedule_n if(self.trustee3_schedule)==1: self.trustee3_schedule_n=1 elif(self.rounds % self.trustee3_schedule == 0 and self.trustee3_schedule != 1) or self.rounds == 1: self.trustee3_schedule_n=self.trustee3_schedule + random.choice([-1,0,1]) else: self.trustee3_schedule_n=self.in_round(self.round_number-1).trustee3_schedule_n #--------------------------------------------------------------------------------------------------------------------------------------------------------------- #Here we add the noise to the arms schedule. Due to the fact we do not know which arms are assigned which schedule, we have to use a series of if statments. #--------------------------------------------------------------------------------------------------------------------------------------------------------------- self.recieved_trustee1=self.sent_amount1 * Constants.multiplication_factor #sum([p.sent_amount1 for p in self.get_players()]) * Constants.multiplication_factor self.recieved_trustee2=self.sent_amount2 * Constants.multiplication_factor #sum([p.sent_amount2 for p in self.get_players()]) * Constants.multiplication_factor self.recieved_trustee3=self.sent_amount3 * Constants.multiplication_factor #sum([p.sent_amount3 for p in self.get_players()]) * Constants.multiplication_factor print("########################################1") print(self.recieved_trustee1) print("----") print(Constants.multiplication_factor) print("#########################################") self.seed1 = random.gauss(.75, .1) self.seed2 = random.gauss(.75, .1) self.seed3 = random.gauss(.75, .1) self.seed1_p2 = random.gauss(1, .1) self.seed2_p2 = random.gauss(1, .1) self.seed3_p2 = random.gauss(1, .1) self.t1_send = self.sent_amount1 #sum([p.sent_amount1 for p in self.get_players()]) self.t2_send = self.sent_amount2 #sum([p.sent_amount2 for p in self.get_players()]) self.t3_send = self.sent_amount3 #sum([p.sent_amount3 for p in self.get_players()]) self.trustor_total = self.t1_send + self.t2_send + self.t3_send ################################################################################################## #------------------------------------------------------------------------------------------------ if (self.rounds % self.trustee1_schedule_n) == 0: self.skip_trustee1 = 1 elif(self.rounds) <= 10: self.skip_trustee1=1 else: self.skip_trustee1=0 print(self.skip_trustee1) #------------------------------------------------------------------------------------------------ if (self.skip_trustee1 == 1 and self.rounds <= 70): self.trusteeSent1 = round( ((self.t1_send * Constants.multiplication_factor) * self.seed1), 0) elif(self.skip_trustee1 ==1 and self.rounds > 70): self.trusteeSent1 = round( ((self.t1_send) * self.seed1_p2 ), 0) else: self.trusteeSent1 =round( self.t1_send, 0) ################################################################################################## #------------------------------------------------------------------------------------------------ if (self.rounds % self.trustee2_schedule_n) == 0: self.skip_trustee2=1 elif(self.rounds) <= 10: self.skip_trustee2=1 else: self.skip_trustee2=0 #------------------------------------------------------------------------------------------------ if (self.skip_trustee2 == 1 and self.rounds <= 70): self.trusteeSent2 = round( ((self.t2_send * Constants.multiplication_factor) * self.seed2), 0) elif(self.skip_trustee2 ==1 and self.rounds > 70): self.trusteeSent2 = round( ((self.t2_send) * self.seed2_p2 ), 0) else: self.trusteeSent2 = round( self.t2_send, 0) ################################################################################################## #------------------------------------------------------------------------------------------------ if (self.rounds % self.trustee3_schedule_n) == 0: self.skip_trustee3=1 elif(self.rounds) <= 10: self.skip_trustee3=1 else: self.skip_trustee3=0 #------------------------------------------------------------------------------------------------ if (self.skip_trustee3 == 1 and self.rounds <= 70): self.trusteeSent3 =round( ((self.t3_send * Constants.multiplication_factor) * self.seed3), 0) elif(self.skip_trustee3 ==1 and self.rounds > 70): self.trusteeSent3 =round( ((self.t3_send) * self.seed3_p2 ), 0) else: self.trusteeSent3 =round( self.t3_send, 0) ################################################################################################## #------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------ ################################################################################################## ################################################################################################## ################################################################################################## self.trustee1_currency= round( self.trusteeSent1 * .0017, 4) self.trustee2_currency= round( self.trusteeSent2 * .0017, 4) self.trustee3_currency= round( self.trusteeSent3 * .0017, 4) self.kept_currency= round( (40 - (self.t1_send + self.t2_send + self.t3_send) ) * .0017, 4) self.trustee_total_currency = round( self.trustee1_currency + self.trustee2_currency + self.trustee3_currency + self.kept_currency, 4) self.cummulative_currency_payoff = round( sum([p.trustee_total_currency for p in self.in_all_rounds()]) , 4) ########################################################################################################################################## ########################################################################################################################################## ########################################################################################################################################## self.trustee_total = self.trusteeSent1 + self.trusteeSent2 + self.trusteeSent3 self.trustorpayoff= self.trustee_total + (40 - self.trustor_total) self.Cummulative_Payoff = sum([p.trustorpayoff for p in self.in_all_rounds()])