from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'meta_results' players_per_group = 6 num_rounds = 1 endowment = c(10) multiplier = 0.5 show_up = c(15) probability = 50 class Subsession(BaseSubsession): pass class Player(BasePlayer): water = models.IntegerField( label="Wie viel Wasser haben Sie während des Experiments ungefähr getrunken?", choices=[ [1, 'keins'], [2, '0-0,25 l'], [3, '0,25-0,5 l'], [4, 'mehr als 0,5 l'], ], ) known_others = models.IntegerField( label="Wie viele der im Raum anwesenden anderen Teilnehmer kennen Sie persönlich?", min=0, max=8, ) known_from = models.IntegerField( blank=True, choices=[ [1, 'Studium'], [2, 'Arbeit'], [3, 'Freizeit'], ], label = "Falls ja, woher kennen Sie sich?" ) exp_own_a_right = models.IntegerField( initial=0 ) exp_own_b_right = models.IntegerField( initial=0 ) exp_other_a_right = models.IntegerField( initial=0 ) exp_other_b_right = models.IntegerField( initial=0 ) exp_right = models.IntegerField( initial=0 ) payoff_extra = models.CurrencyField( initial=0 ) payback_a = models.CurrencyField( initial=0 ) payback_b = models.CurrencyField( initial=0 ) subtract_b = models.CurrencyField( initial=0 ) def role(self): if self.id_in_group <= 3: return 'subgroup1' else: return 'subgroup2' def set_final(self): self.role=self.participant.vars['role'] self.final_payoff_with_endowment =self.player.payoff + Constants.show_up + self.participant.vars['scl_payoff'] + self.participant.vars['rows_payoff'] + self.player.payoff_extra self.participant.vars['final_payoff_with_endowment'] = self.final_payoff_with_endowment self.participant.vars['exp_right'] = self.player.exp_right self.participant.vars['payoff_extra'] = 0.5 * (self.player.exp_right) class Group( BaseGroup ): #first mover subgroup1_within = models.CurrencyField( initial=0 ) subgroup1_between = models.CurrencyField( initial=0 ) subgroup2_within = models.CurrencyField( initial=0 ) subgroup2_between = models.CurrencyField( initial=0 ) #expectations avg_subgroup1_within = models.CurrencyField( initial=0 ) avg_subgroup1_between = models.CurrencyField( initial=0 ) avg_subgroup2_within = models.CurrencyField( initial=0 ) avg_subgroup2_between = models.CurrencyField( initial=0 ) #second mover subgroup1_within_0 = models.CurrencyField( initial=0 ) subgroup1_between_0 = models.CurrencyField( initial=0 ) subgroup2_within_0 = models.CurrencyField( initial=0 ) subgroup2_between_0 = models.CurrencyField( initial=0 ) subgroup1_within_1 = models.CurrencyField( initial=0 ) subgroup1_between_1 = models.CurrencyField( initial=0 ) subgroup2_within_1 = models.CurrencyField( initial=0 ) subgroup2_between_1 = models.CurrencyField( initial=0 ) subgroup1_within_2 = models.CurrencyField( initial=0 ) subgroup1_between_2 = models.CurrencyField( initial=0 ) subgroup2_within_2 = models.CurrencyField( initial=0 ) subgroup2_between_2 = models.CurrencyField( initial=0 ) subgroup1_within_3 = models.CurrencyField( initial=0 ) subgroup1_between_3 = models.CurrencyField( initial=0 ) subgroup2_within_3 = models.CurrencyField( initial=0 ) subgroup2_between_3 = models.CurrencyField( initial=0 ) subgroup1_within_4 = models.CurrencyField( initial=0 ) subgroup1_between_4 = models.CurrencyField( initial=0 ) subgroup2_within_4 = models.CurrencyField( initial=0 ) subgroup2_between_4 = models.CurrencyField( initial=0 ) subgroup1_within_6 = models.CurrencyField( initial=0 ) subgroup1_between_6 = models.CurrencyField( initial=0 ) subgroup2_within_6 = models.CurrencyField( initial=0 ) subgroup2_between_6 = models.CurrencyField( initial=0 ) subgroup1_within_8 = models.CurrencyField( initial=0 ) subgroup1_between_8 = models.CurrencyField( initial=0 ) subgroup2_within_8 = models.CurrencyField( initial=0 ) subgroup2_between_8 = models.CurrencyField( initial=0 ) subgroup1_within_10 = models.CurrencyField( initial=0 ) subgroup1_between_10 = models.CurrencyField( initial=0 ) subgroup2_within_10 = models.CurrencyField( initial=0 ) subgroup2_between_10 = models.CurrencyField( initial=0 ) subgroup1_within_12 = models.CurrencyField( initial=0 ) subgroup1_between_12 = models.CurrencyField( initial=0 ) subgroup2_within_12 = models.CurrencyField( initial=0 ) subgroup2_between_12 = models.CurrencyField( initial=0 ) subgroup1_within_14 = models.CurrencyField( initial=0 ) subgroup1_between_14 = models.CurrencyField( initial=0 ) subgroup2_within_14 = models.CurrencyField( initial=0 ) subgroup2_between_14 = models.CurrencyField( initial=0 ) subgroup1_within_16 = models.CurrencyField( initial=0 ) subgroup1_between_16 = models.CurrencyField( initial=0 ) subgroup2_within_16 = models.CurrencyField( initial=0 ) subgroup2_between_16 = models.CurrencyField( initial=0 ) subgroup1_within_18 = models.CurrencyField( initial=0 ) subgroup1_between_18 = models.CurrencyField( initial=0 ) subgroup2_within_18 = models.CurrencyField( initial=0 ) subgroup2_between_18 = models.CurrencyField( initial=0 ) subgroup1_within_20 = models.CurrencyField( initial=0 ) subgroup1_between_20 = models.CurrencyField( initial=0 ) subgroup2_within_20 = models.CurrencyField( initial=0 ) subgroup2_between_20 = models.CurrencyField( initial=0 ) subgroup1_within_22 = models.CurrencyField( initial=0 ) subgroup1_between_22 = models.CurrencyField( initial=0 ) subgroup2_within_22 = models.CurrencyField( initial=0 ) subgroup2_between_22 = models.CurrencyField( initial=0 ) subgroup1_within_24 = models.CurrencyField( initial=0 ) subgroup1_between_24 = models.CurrencyField( initial=0 ) subgroup2_within_24 = models.CurrencyField( initial=0 ) subgroup2_between_24 = models.CurrencyField( initial=0 ) subgroup1_within_26 = models.CurrencyField( initial=0 ) subgroup1_between_26 = models.CurrencyField( initial=0 ) subgroup2_within_26 = models.CurrencyField( initial=0 ) subgroup2_between_26 = models.CurrencyField( initial=0 ) subgroup1_within_28 = models.CurrencyField( initial=0 ) subgroup1_between_28 = models.CurrencyField( initial=0 ) subgroup2_within_28 = models.CurrencyField( initial=0 ) subgroup2_between_28 = models.CurrencyField( initial=0 ) subgroup1_within_30 = models.CurrencyField( initial=0 ) subgroup1_between_30 = models.CurrencyField( initial=0 ) subgroup2_within_30 = models.CurrencyField( initial=0 ) subgroup2_between_30 = models.CurrencyField( initial=0 ) def set_payoffs(self): #p = Constants.probability #rnd = random.randint(1, 100) #self.outcome_to_pay = "first" if rnd <= p else "second" for p in self.get_players(): if p.role() == 'subgroup1': #first mover self.subgroup1_within += p.participant.vars['contribution_within'] self.avg_subgroup1_within = (self.subgroup1_within - p.participant.vars['contribution_within']) / 2 self.subgroup1_between += p.participant.vars['contribution_between'] self.avg_subgroup1_between = (self.subgroup1_between - p.participant.vars['contribution_between']) / 2 #second mover self.subgroup1_within_0 += p.participant.vars['contribution_within_0'] self.subgroup1_between_0 += p.participant.vars['contribution_between_0'] self.subgroup1_within_2 += p.participant.vars['contribution_within_2'] self.subgroup1_between_2 += p.participant.vars['contribution_between_2'] self.subgroup1_within_4 += p.participant.vars['contribution_within_4'] self.subgroup1_between_4 += p.participant.vars['contribution_between_4'] self.subgroup1_within_6 += p.participant.vars['contribution_within_6'] self.subgroup1_between_6 += p.participant.vars['contribution_between_6'] self.subgroup1_within_8 += p.participant.vars['contribution_within_8'] self.subgroup1_between_8 += p.participant.vars['contribution_between_8'] self.subgroup1_within_10 += p.participant.vars['contribution_within_10'] self.subgroup1_between_10 += p.participant.vars['contribution_between_10'] self.subgroup1_within_12 += p.participant.vars['contribution_within_12'] self.subgroup1_between_12 += p.participant.vars['contribution_between_12'] self.subgroup1_within_14 += p.participant.vars['contribution_within_14'] self.subgroup1_between_14 += p.participant.vars['contribution_between_14'] self.subgroup1_within_16 += p.participant.vars['contribution_within_16'] self.subgroup1_between_16 += p.participant.vars['contribution_between_16'] self.subgroup1_within_18 += p.participant.vars['contribution_within_18'] self.subgroup1_between_18 += p.participant.vars['contribution_between_18'] self.subgroup1_within_20 += p.participant.vars['contribution_within_20'] self.subgroup1_between_20 += p.participant.vars['contribution_between_20'] self.subgroup1_within_22 += p.participant.vars['contribution_within_22'] self.subgroup1_between_22 += p.participant.vars['contribution_between_22'] self.subgroup1_within_24 += p.participant.vars['contribution_within_24'] self.subgroup1_between_24 += p.participant.vars['contribution_between_24'] self.subgroup1_within_26 += p.participant.vars['contribution_within_26'] self.subgroup1_between_26 += p.participant.vars['contribution_between_26'] self.subgroup1_within_28 += p.participant.vars['contribution_within_28'] self.subgroup1_between_28 += p.participant.vars['contribution_between_28'] self.subgroup1_within_30 += p.participant.vars['contribution_within_30'] self.subgroup1_between_30 += p.participant.vars['contribution_between_30'] elif p.role() == 'subgroup2': #first mover self.subgroup2_within += p.participant.vars['contribution_within'] self.avg_subgroup2_within = (self.subgroup2_within - p.participant.vars['contribution_within']) / 2 self.subgroup2_between += p.participant.vars['contribution_between'] self.avg_subgroup2_between = (self.subgroup2_between - p.participant.vars['contribution_between']) / 2 #second mover self.subgroup2_within_0 += p.participant.vars['contribution_within_0'] self.subgroup2_between_0 += p.participant.vars['contribution_between_0'] self.subgroup2_within_2 += p.participant.vars['contribution_within_2'] self.subgroup2_between_2 += p.participant.vars['contribution_between_2'] self.subgroup2_within_4 += p.participant.vars['contribution_within_4'] self.subgroup2_between_4 += p.participant.vars['contribution_between_4'] self.subgroup2_within_6 += p.participant.vars['contribution_within_6'] self.subgroup2_between_6 += p.participant.vars['contribution_between_6'] self.subgroup2_within_8 += p.participant.vars['contribution_within_8'] self.subgroup2_between_8 += p.participant.vars['contribution_between_8'] self.subgroup2_within_10 += p.participant.vars['contribution_within_10'] self.subgroup2_between_10 += p.participant.vars['contribution_between_10'] self.subgroup2_within_12 += p.participant.vars['contribution_within_12'] self.subgroup2_between_12 += p.participant.vars['contribution_between_12'] self.subgroup2_within_14 += p.participant.vars['contribution_within_14'] self.subgroup2_between_14 += p.participant.vars['contribution_between_14'] self.subgroup2_within_16 += p.participant.vars['contribution_within_16'] self.subgroup2_between_16 += p.participant.vars['contribution_between_16'] self.subgroup2_within_18 += p.participant.vars['contribution_within_18'] self.subgroup2_between_18 += p.participant.vars['contribution_between_18'] self.subgroup2_within_20 += p.participant.vars['contribution_within_20'] self.subgroup2_between_20 += p.participant.vars['contribution_between_20'] self.subgroup2_within_22 += p.participant.vars['contribution_within_22'] self.subgroup2_between_22 += p.participant.vars['contribution_between_22'] self.subgroup2_within_24 += p.participant.vars['contribution_within_24'] self.subgroup2_between_24 += p.participant.vars['contribution_between_24'] self.subgroup2_within_26 += p.participant.vars['contribution_within_26'] self.subgroup2_between_26 += p.participant.vars['contribution_between_26'] self.subgroup2_within_28 += p.participant.vars['contribution_within_28'] self.subgroup2_between_28 += p.participant.vars['contribution_between_28'] self.subgroup2_within_30 += p.participant.vars['contribution_within_30'] self.subgroup2_between_30 += p.participant.vars['contribution_between_30'] for p in self.get_players(): if p.role() == 'subgroup1': #expectations if p.participant.vars['exp_own_a'] == round( self.avg_subgroup1_within ): p.exp_own_a_right = 1 if p.participant.vars['exp_own_b'] == round( self.avg_subgroup1_between ): p.exp_own_b_right = 1 if p.participant.vars['exp_other_a'] == round( self.avg_subgroup2_within ): p.exp_other_a_right = 1 if p.participant.vars['exp_other_b'] == round( self.avg_subgroup2_between ): p.exp_other_b_right = 1 elif p.role() == 'subgroup2': if p.participant.vars['exp_own_a'] == round( self.avg_subgroup2_within ): p.exp_own_a_right = 1 if p.participant.vars['exp_own_b'] == round( self.avg_subgroup2_between ): p.exp_own_b_right = 1 if p.participant.vars['exp_other_a'] == round( self.avg_subgroup1_within ): p.exp_other_a_right = 1 if p.participant.vars['exp_other_b'] == round( self.avg_subgroup1_between ): p.exp_other_b_right = 1 for p in self.get_players(): if p.role() == 'subgroup1': p.exp_right = p.exp_own_a_right +p.exp_own_b_right +p.exp_other_a_right +p.exp_other_a_right p.payoff_extra = (p.exp_own_a_right + p.exp_own_b_right + p.exp_other_a_right + p.exp_other_a_right) * 0.5 p.payoff_first = Constants.endowment - p.participant.vars['contribution_within'] - p.participant.vars['contribution_between'] + Constants.multiplier * ( self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) p.payback_a = Constants.multiplier * self.subgroup1_within p.payback_b = Constants.multiplier * self.subgroup1_between p.subtract_b = - Constants.multiplier * self.subgroup2_between elif p.role() == 'subgroup2': p.exp_right = p.exp_own_a_right + p.exp_own_b_right + p.exp_other_a_right + p.exp_other_a_right p.payoff_extra = (p.exp_own_a_right + p.exp_own_b_right + p.exp_other_a_right + p.exp_other_a_right) * 0.5 p.payoff_first = Constants.endowment - p.participant.vars['contribution_within'] - p.participant.vars[ 'contribution_between'] + Constants.multiplier * ( self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) p.payback_a = Constants.multiplier * self.subgroup2_within p.payback_b = Constants.multiplier * self.subgroup2_between p.subtract_b = - Constants.multiplier * self.subgroup1_between for p in self.get_players(): if p.role() == 'subgroup1': if self.subgroup2_between == 0 | self.subgroup2_between == 1: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_0'] - p.participant.vars['contribution_between_0'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 2 | self.subgroup2_between == 3: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_2'] - p.participant.vars['contribution_between_2'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 4 | self.subgroup2_between == 5: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_4'] - p.participant.vars['contribution_between_4'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 6 | self.subgroup2_between == 7: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_6'] - p.participant.vars['contribution_between_6'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 8 | self.subgroup2_between == 9: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_8'] - p.participant.vars['contribution_between_8'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 10 | self.subgroup2_between == 11 : p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_10'] - p.participant.vars['contribution_between_10'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 12| self.subgroup2_between == 13 : p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_12'] - p.participant.vars['contribution_between_12'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 14 | self.subgroup2_between == 15: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_14'] - p.participant.vars['contribution_between_14'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 16 | self.subgroup2_between == 17: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_16'] - p.participant.vars['contribution_between_16'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 18 | self.subgroup2_between == 18: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_18'] - p.participant.vars['contribution_between_18'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 20 | self.subgroup2_between == 21: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_20'] - p.participant.vars['contribution_between_20'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 22 | self.subgroup2_between == 23: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_22'] - p.participant.vars['contribution_between_22'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 24 | self.subgroup2_between == 25: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_24'] - p.participant.vars['contribution_between_24'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 26 | self.subgroup2_between == 27: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_26'] - p.participant.vars['contribution_between_26'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 28 | self.subgroup2_between == 29: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_28'] - p.participant.vars['contribution_between_28'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif self.subgroup2_between == 30: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_30'] - p.participant.vars['contribution_between_30'] + Constants.multiplier * (self.subgroup1_within + self.subgroup1_between - self.subgroup2_between) elif p.role() == 'subgroup2': if self.subgroup1_between == 0 | self.subgroup1_between == 1: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_0'] - p.participant.vars['contribution_between_0'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 2 | self.subgroup1_between == 3: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_2'] - p.participant.vars['contribution_between_2'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 4 | self.subgroup1_between == 5: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_4'] - p.participant.vars['contribution_between_4'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 6 | self.subgroup1_between == 7: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_6'] - p.participant.vars['contribution_between_6'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 8 | self.subgroup1_between == 9: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_8'] - p.participant.vars['contribution_between_8'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 10 | self.subgroup1_between == 11 : p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_10'] - p.participant.vars['contribution_between_10'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 12| self.subgroup1_between == 13 : p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_12'] - p.participant.vars['contribution_between_12'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 14 | self.subgroup1_between == 15: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_14'] - p.participant.vars['contribution_between_14'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 16 | self.subgroup1_between == 17: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_16'] - p.participant.vars['contribution_between_16'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 18 | self.subgroup1_between == 18: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_18'] - p.participant.vars['contribution_between_18'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 20 | self.subgroup1_between == 21: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_20'] - p.participant.vars['contribution_between_20'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 22 | self.subgroup1_between == 23: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_22'] - p.participant.vars['contribution_between_22'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 24 | self.subgroup1_between == 25: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_24'] - p.participant.vars['contribution_between_24'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 26 | self.subgroup1_between == 27: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_26'] - p.participant.vars['contribution_between_26'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 28 | self.subgroup1_between == 29: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_28'] - p.participant.vars['contribution_between_28'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) elif self.subgroup1_between == 30: p.payoff_second = Constants.endowment - p.participant.vars['contribution_within_30'] - p.participant.vars['contribution_between_30'] + Constants.multiplier * (self.subgroup2_within + self.subgroup2_between - self.subgroup1_between) for p in self.get_players(): if p.role() == 'subgroup1': if self.outcome_to_pay == "first": p.payoff = p.payoff_first else: p.payoff = p.payoff_second elif p.role() == 'subgroup2': if self.outcome_to_pay == "first": p.payoff = p.payoff_second else: p.payoff = p.payoff_first