from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = '' class Constants(BaseConstants): name_in_url = 'RobotUmpire_honest_corrupt' players_per_group = 3 num_rounds = 10 Infocost = 1 Endowment = c(14) multiplier = 2 instructionsplayer_template = 'RobotUmpire_honest_corrupt/instructionsplayer.html' class Subsession(BaseSubsession): grup1pl1 = models.StringField() grup1pl2 = models.StringField() grup1pl3 = models.StringField() grup2pl1 = models.StringField() grup2pl2 = models.StringField() grup2pl3 = models.StringField() grup3pl1 = models.StringField() grup3pl2 = models.StringField() grup3pl3 = models.StringField() grup4pl1 = models.StringField() grup4pl2 = models.StringField() grup4pl3 = models.StringField() grup5pl1 = models.StringField() grup5pl2 = models.StringField() grup5pl3 = models.StringField() grup6pl1 = models.StringField() grup6pl2 = models.StringField() grup6pl3 = models.StringField() grup7pl1 = models.StringField() grup7pl2 = models.StringField() grup7pl3 = models.StringField() grup8pl1 = models.StringField() grup8pl2 = models.StringField() grup8pl3 = models.StringField() g1pl1 = models.StringField() g1pl2 = models.StringField() g1pl3 = models.StringField() g2pl1 = models.StringField() g2pl2 = models.StringField() g2pl3 = models.StringField() g2pl4 = models.StringField() g3pl1 = models.StringField() g3pl2 = models.StringField() g3pl3 = models.StringField() g4pl1 = models.StringField() g4pl2 = models.StringField() g4pl3 = models.StringField() g5pl1 = models.StringField() g5pl3 = models.StringField() g5pl2 = models.StringField() g6pl1 = models.StringField() g6pl2 = models.StringField() g6pl3 = models.StringField() g7pl1 = models.StringField() g7pl2 = models.StringField() g7pl3 = models.StringField() g8pl1 = models.StringField() g8pl2 = models.StringField() g8pl3 = models.StringField() puniz1pl1 = models.StringField() puniz1pl2 = models.StringField() puniz1pl3 = models.StringField() puniz2pl1 = models.StringField() puniz2pl2 = models.StringField() puniz2pl3 = models.StringField() puniz3pl1 = models.StringField() puniz3pl2 = models.StringField() puniz3pl3 = models.StringField() puniz4pl1 = models.StringField() puniz4pl3 = models.StringField() puniz4pl2 = models.StringField() puniz5pl1 = models.StringField() puniz5pl2 = models.StringField() puniz5pl3 = models.StringField() puniz6pl1 = models.StringField() puniz6pl2 = models.StringField() puniz6pl3 = models.StringField() puniz7pl1 = models.StringField() puniz7pl2 = models.StringField() puniz7pl3 = models.StringField() puniz8pl1 = models.StringField() puniz8pl2 = models.StringField() puniz8pl3 = models.StringField() p1pl1 = models.StringField() p1pl2 = models.StringField() p1pl3 = models.StringField() p2pl1 = models.StringField() p2pl2 = models.StringField() p2pl3 = models.StringField() p3pl1 = models.StringField() p3pl2 = models.StringField() p3pl3 = models.StringField() p4pl2 = models.StringField() p4pl1 = models.StringField() p4pl3 = models.StringField() p5pl1 = models.StringField() p5pl2 = models.StringField() p5pl3 = models.StringField() p6pl1 = models.StringField() p6pl2 = models.StringField() p6pl3 = models.StringField() p7pl1 = models.StringField() p7pl2 = models.StringField() p7pl3 = models.StringField() p8pl1 = models.StringField() p8pl2 = models.StringField() p8pl3 = models.StringField() corruzg1 = models.IntegerField() corruzg2 = models.IntegerField() corruzg3 = models.IntegerField() corruzg4 = models.IntegerField() corruzg5 = models.IntegerField() corruzg6 = models.IntegerField() corruzg7 = models.IntegerField() corruzg8 = models.IntegerField() corruttorig1 = models.IntegerField() corruttorig2 = models.IntegerField() corruttorig3 = models.IntegerField() corruttorig4 = models.IntegerField() corruttorig5 = models.IntegerField() corruttorig6 = models.IntegerField() corruttorig7 = models.IntegerField() corruttorig8 = models.IntegerField() corruzprimag1 = models.IntegerField() corruzprimag2 = models.IntegerField() corruzprimag3 = models.IntegerField() corruzprimag4 = models.IntegerField() corruzprimag5 = models.IntegerField() corruzprimag6 = models.IntegerField() corruzprimag7 = models.IntegerField() corruzprimag8 = models.IntegerField() corruttprimag1 = models.IntegerField() corruttprimag2 = models.IntegerField() corruttprimag3 = models.IntegerField() corruttprimag4 = models.IntegerField() corruttprimag5 = models.IntegerField() corruttprimag6 = models.IntegerField() corruttprimag7 = models.IntegerField() corruttprimag8 = models.IntegerField() partecipantiprima = models.IntegerField() partecipantiprima1 = models.IntegerField() partecipantiprima2 = models.IntegerField() partecipantiprima3 = models.IntegerField() partecipantiprima4 = models.IntegerField() partecipantiprima5 = models.IntegerField() partecipantiprima6 = models.IntegerField() partecipantiprima7 = models.IntegerField() partecipantiprima8 = models.IntegerField() partecipantipg1 = models.IntegerField() partecipantipg2 = models.IntegerField() partecipantipg3 = models.IntegerField() partecipantipg4 = models.IntegerField() partecipantipg5 = models.IntegerField() partecipantipg6 = models.IntegerField() partecipantipg7 = models.IntegerField() partecipantipg8 = models.IntegerField() def creating_session(self): self.group_randomly(fixed_id_in_group = False) def contribuzioni_gruppi(self): for p in self.get_players(): if p.numberpl == 2 and p.numberg == 1: self.grup1pl2 = p.gruppo1pl2 if p.numberpl == 1 and p.numberg == 1: self.grup1pl1 = p.gruppo1pl1 if p.numberpl == 3 and p.numberg == 1: self.grup1pl3 = p.gruppo1pl3 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 2: self.grup2pl1 = p.gruppo2pl1 if p.numberpl == 3 and p.numberg == 2: self.grup2pl3 = p.gruppo2pl3 if p.numberpl == 2 and p.numberg == 2: self.grup2pl2 = p.gruppo2pl2 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 3: self.grup3pl1 = p.gruppo3pl1 if p.numberpl == 2 and p.numberg == 3: self.grup3pl2 = p.gruppo3pl2 if p.numberpl == 3 and p.numberg == 3: self.grup3pl3 = p.gruppo3pl3 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 4: self.grup4pl2 = p.gruppo4pl2 if p.numberpl == 3 and p.numberg == 4: self.grup4pl3 = p.gruppo4pl3 if p.numberpl == 1 and p.numberg == 4: self.grup4pl1 = p.gruppo4pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 5: self.grup5pl2 = p.gruppo5pl2 if p.numberpl == 3 and p.numberg == 5: self.grup5pl3 = p.gruppo5pl3 if p.numberpl == 1 and p.numberg == 5: self.grup5pl1 = p.gruppo5pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 6: self.grup6pl2 = p.gruppo6pl2 if p.numberpl == 3 and p.numberg == 6: self.grup6pl3 = p.gruppo6pl3 if p.numberpl == 1 and p.numberg == 6: self.grup6pl1 = p.gruppo6pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 7: self.grup7pl2 = p.gruppo7pl2 if p.numberpl == 3 and p.numberg == 7: self.grup7pl3 = p.gruppo7pl3 if p.numberpl == 1 and p.numberg == 7: self.grup7pl1 = p.gruppo7pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 8: self.grup8pl2 = p.gruppo8pl2 if p.numberpl == 3 and p.numberg == 8: self.grup8pl3 = p.gruppo8pl3 if p.numberpl == 1 and p.numberg == 8: self.grup8pl1 = p.gruppo8pl1 def contribuzioni_gruppi_precedenti(self): self.g1pl2 = self.in_round(self.round_number - 1).grup1pl2 self.g1pl3 = self.in_round(self.round_number - 1).grup1pl3 self.g1pl1 = self.in_round(self.round_number - 1).grup1pl1 self.g2pl2 = self.in_round(self.round_number - 1).grup2pl2 self.g2pl3 = self.in_round(self.round_number - 1).grup2pl3 self.g2pl1 = self.in_round(self.round_number - 1).grup2pl1 self.g3pl2 = self.in_round(self.round_number - 1).grup3pl2 self.g3pl3 = self.in_round(self.round_number - 1).grup3pl3 self.g3pl1 = self.in_round(self.round_number - 1).grup3pl1 self.g4pl2 = self.in_round(self.round_number - 1).grup4pl2 self.g4pl3 = self.in_round(self.round_number - 1).grup4pl3 self.g4pl1 = self.in_round(self.round_number - 1).grup4pl1 self.g5pl3 = self.in_round(self.round_number - 1).grup5pl3 self.g5pl1 = self.in_round(self.round_number - 1).grup5pl1 self.g5pl2 = self.in_round(self.round_number - 1).grup5pl2 self.g6pl3 = self.in_round(self.round_number - 1).grup6pl3 self.g6pl1 = self.in_round(self.round_number - 1).grup6pl1 self.g6pl2 = self.in_round(self.round_number - 1).grup6pl2 self.g7pl3 = self.in_round(self.round_number - 1).grup7pl3 self.g7pl1 = self.in_round(self.round_number - 1).grup7pl1 self.g7pl2 = self.in_round(self.round_number - 1).grup7pl2 self.g8pl3 = self.in_round(self.round_number - 1).grup8pl3 self.g8pl1 = self.in_round(self.round_number - 1).grup8pl1 self.g8pl2 = self.in_round(self.round_number - 1).grup8pl2 def punizioni(self): for p in self.get_players(): if p.numberpl == 2 and p.numberg == 1: self.puniz1pl2 = p.punizgruppo1pl2 if p.numberpl == 1 and p.numberg == 1: self.puniz1pl1 = p.punizgruppo1pl1 if p.numberpl == 3 and p.numberg == 1: self.puniz1pl3 = p.punizgruppo1pl3 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 2: self.puniz2pl1 = p.punizgruppo2pl1 if p.numberpl == 3 and p.numberg == 2: self.puniz2pl3 = p.punizgruppo2pl3 if p.numberpl == 2 and p.numberg == 2: self.puniz2pl2 = p.punizgruppo2pl2 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 3: self.puniz3pl1 = p.punizgruppo3pl1 if p.numberpl == 2 and p.numberg == 3: self.puniz3pl2 = p.punizgruppo3pl2 if p.numberpl == 3 and p.numberg == 3: self.puniz3pl3 = p.punizgruppo3pl3 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 4: self.puniz4pl2 = p.punizgruppo4pl2 if p.numberpl == 3 and p.numberg == 4: self.puniz4pl3 = p.punizgruppo4pl3 if p.numberpl == 1 and p.numberg == 4: self.puniz4pl1 = p.punizgruppo4pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 5: self.puniz5pl2 = p.punizgruppo5pl2 if p.numberpl == 3 and p.numberg == 5: self.puniz5pl3 = p.punizgruppo5pl3 if p.numberpl == 1 and p.numberg == 5: self.puniz5pl1 = p.punizgruppo5pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 6: self.puniz6pl2 = p.punizgruppo6pl2 if p.numberpl == 3 and p.numberg == 6: self.puniz6pl3 = p.punizgruppo6pl3 if p.numberpl == 1 and p.numberg == 6: self.puniz6pl1 = p.punizgruppo6pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 7: self.puniz7pl2 = p.punizgruppo7pl2 if p.numberpl == 3 and p.numberg == 7: self.puniz7pl3 = p.punizgruppo7pl3 if p.numberpl == 1 and p.numberg == 7: self.puniz7pl1 = p.punizgruppo7pl1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 8: self.puniz8pl2 = p.punizgruppo8pl2 if p.numberpl == 3 and p.numberg == 8: self.puniz8pl3 = p.punizgruppo8pl3 if p.numberpl == 1 and p.numberg == 8: self.puniz8pl1 = p.punizgruppo8pl1 def punizioni_gruppi_precedenti(self): self.p1pl2 = self.in_round(self.round_number - 1).puniz1pl2 self.p1pl3 = self.in_round(self.round_number - 1).puniz1pl3 self.p1pl1 = self.in_round(self.round_number - 1).puniz1pl1 self.p2pl2 = self.in_round(self.round_number - 1).puniz2pl2 self.p2pl3 = self.in_round(self.round_number - 1).puniz2pl3 self.p2pl1 = self.in_round(self.round_number - 1).puniz2pl1 self.p3pl2 = self.in_round(self.round_number - 1).puniz3pl2 self.p3pl3 = self.in_round(self.round_number - 1).puniz3pl3 self.p3pl1 = self.in_round(self.round_number - 1).puniz3pl1 self.p4pl2 = self.in_round(self.round_number - 1).puniz4pl2 self.p4pl3 = self.in_round(self.round_number - 1).puniz4pl3 self.p4pl1 = self.in_round(self.round_number - 1).puniz4pl1 self.p5pl2 = self.in_round(self.round_number - 1).puniz5pl2 self.p5pl3 = self.in_round(self.round_number - 1).puniz5pl3 self.p5pl1 = self.in_round(self.round_number - 1).puniz5pl1 self.p6pl2 = self.in_round(self.round_number - 1).puniz6pl2 self.p6pl3 = self.in_round(self.round_number - 1).puniz6pl3 self.p6pl1 = self.in_round(self.round_number - 1).puniz6pl1 self.p7pl2 = self.in_round(self.round_number - 1).puniz7pl2 self.p7pl3 = self.in_round(self.round_number - 1).puniz7pl3 self.p7pl1 = self.in_round(self.round_number - 1).puniz7pl1 self.p8pl2 = self.in_round(self.round_number - 1).puniz8pl2 self.p8pl3 = self.in_round(self.round_number - 1).puniz8pl3 self.p8pl1 = self.in_round(self.round_number - 1).puniz8pl1 def corruzione(self): for p in self.get_players(): if p.numberpl == 2 and p.numberg == 1: self.corruzg1 = p.corruzg1 if p.numberpl == 1 and p.numberg == 1: self.corruzg1 = p.corruzg1 if p.numberpl == 3 and p.numberg == 1: self.corruzg1 = p.corruzg1 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 2: self.corruzg2 = p.corruzg2 if p.numberpl == 3 and p.numberg == 2: self.corruzg2 = p.corruzg2 if p.numberpl == 2 and p.numberg == 2: self.corruzg2 = p.corruzg2 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 3: self.corruzg3 = p.corruzg3 if p.numberpl == 2 and p.numberg == 3: self.corruzg3 = p.corruzg3 if p.numberpl == 3 and p.numberg == 3: self.corruzg3 = p.corruzg3 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 4: self.corruzg4 = p.corruzg4 if p.numberpl == 3 and p.numberg == 4: self.corruzg4 = p.corruzg4 if p.numberpl == 1 and p.numberg == 4: self.corruzg4 = p.corruzg4 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 5: self.corruzg5 = p.corruzg5 if p.numberpl == 3 and p.numberg == 5: self.corruzg5 = p.corruzg5 if p.numberpl == 1 and p.numberg == 5: self.corruzg5 = p.corruzg5 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 6: self.corruzg6 = p.corruzg6 if p.numberpl == 3 and p.numberg == 6: self.corruzg6 = p.corruzg6 if p.numberpl == 1 and p.numberg == 6: self.corruzg6 = p.corruzg6 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 7: self.corruzg7 = p.corruzg7 if p.numberpl == 3 and p.numberg == 7: self.corruzg7 = p.corruzg7 if p.numberpl == 1 and p.numberg == 7: self.corruzg7 = p.corruzg7 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 8: self.corruzg8 = p.corruzg8 if p.numberpl == 3 and p.numberg == 8: self.corruzg8 = p.corruzg8 if p.numberpl == 1 and p.numberg == 8: self.corruzg8 = p.corruzg8 def corruttori2(self): for p in self.get_players(): if p.numberpl == 2 and p.numberg == 1: self.corruttorig1 = p.corruttorig1 if p.numberpl == 1 and p.numberg == 1: self.corruttorig1 = p.corruttorig1 if p.numberpl == 3 and p.numberg == 1: self.corruttorig1 = p.corruttorig1 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 2: self.corruttorig2 = p.corruttorig2 if p.numberpl == 3 and p.numberg == 2: self.corruttorig2 = p.corruttorig2 if p.numberpl == 2 and p.numberg == 2: self.corruttorig2 = p.corruttorig2 for p in self.get_players(): if p.numberpl == 1 and p.numberg == 3: self.corruttorig3 = p.corruttorig3 if p.numberpl == 2 and p.numberg == 3: self.corruttorig3 = p.corruttorig3 if p.numberpl == 3 and p.numberg == 3: self.corruttorig3 = p.corruttorig3 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 4: self.corruttorig4 = p.corruttorig4 if p.numberpl == 3 and p.numberg == 4: self.corruttorig4 = p.corruttorig4 if p.numberpl == 1 and p.numberg == 4: self.corruttorig4 = p.corruttorig4 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 5: self.corruttorig5 = p.corruttorig5 if p.numberpl == 3 and p.numberg == 5: self.corruttorig5 = p.corruttorig5 if p.numberpl == 1 and p.numberg == 5: self.corruttorig5 = p.corruttorig5 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 6: self.corruttorig6 = p.corruttorig6 if p.numberpl == 3 and p.numberg == 6: self.corruttorig6 = p.corruttorig6 if p.numberpl == 1 and p.numberg == 6: self.corruttorig6 = p.corruttorig6 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 7: self.corruttorig7 = p.corruttorig7 if p.numberpl == 3 and p.numberg == 7: self.corruttorig7 = p.corruttorig7 if p.numberpl == 1 and p.numberg == 7: self.corruttorig7 = p.corruttorig7 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 8: self.corruttorig8 = p.corruttorig8 if p.numberpl == 3 and p.numberg == 8: self.corruttorig8 = p.corruttorig8 if p.numberpl == 1 and p.numberg == 8: self.corruttorig8 = p.corruttorig8 def corruttoriprima(self): self.corruttprimag1 = self.in_round(self.round_number - 1).corruttorig1 self.corruttprimag2 = self.in_round(self.round_number - 1).corruttorig2 self.corruttprimag3 = self.in_round(self.round_number - 1).corruttorig3 self.corruttprimag4 = self.in_round(self.round_number - 1).corruttorig4 self.corruttprimag5 = self.in_round(self.round_number - 1).corruttorig5 self.corruttprimag6 = self.in_round(self.round_number - 1).corruttorig6 self.corruttprimag7 = self.in_round(self.round_number - 1).corruttorig7 self.corruttprimag8 = self.in_round(self.round_number - 1).corruttorig8 def corruzioneprima(self): self.corruzprimag1 = self.in_round(self.round_number - 1).corruzg1 self.corruzprimag2 = self.in_round(self.round_number - 1).corruzg2 self.corruzprimag3 = self.in_round(self.round_number - 1).corruzg3 self.corruzprimag4 = self.in_round(self.round_number - 1).corruzg4 self.corruzprimag5 = self.in_round(self.round_number - 1).corruzg5 self.corruzprimag6 = self.in_round(self.round_number - 1).corruzg6 self.corruzprimag7 = self.in_round(self.round_number - 1).corruzg7 self.corruzprimag8 = self.in_round(self.round_number - 1).corruzg8 def corruttori(self): for p in self.get_players(): if p.corruttori == 0 and p.numberg == 1: self.corruttorig1 = 0 if p.corruttori == 1 and p.numberg == 1: self.corruttorig1 = 1 if p.corruttori == 2 and p.numberg == 1: self.corruttorig1 = 2 if p.corruttori == 3 and p.numberg == 1: self.corruttorig1 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 2: self.corruttorig2 = 0 if p.corruttori == 1 and p.numberg == 2: self.corruttorig2 = 1 if p.corruttori == 2 and p.numberg == 2: self.corruttorig2 = 2 if p.corruttori == 3 and p.numberg == 2: self.corruttorig2 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 3: self.corruttorig3 = 0 if p.corruttori == 1 and p.numberg == 3: self.corruttorig3 = 1 if p.corruttori == 2 and p.numberg == 3: self.corruttorig3 = 2 if p.corruttori == 3 and p.numberg == 3: self.corruttorig3 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 4: self.corruttorig4 = 0 if p.corruttori == 1 and p.numberg == 4: self.corruttorig4 = 1 if p.corruttori == 2 and p.numberg == 4: self.corruttorig4 = 2 if p.corruttori == 3 and p.numberg == 4: self.corruttorig4 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 5: self.corruttorig5 = 0 if p.corruttori == 1 and p.numberg == 5: self.corruttorig5 = 1 if p.corruttori == 2 and p.numberg == 5: self.corruttorig5 = 2 if p.corruttori == 3 and p.numberg == 5: self.corruttorig5 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 6: self.corruttorig6 = 0 if p.corruttori == 1 and p.numberg == 6: self.corruttorig6 = 1 if p.corruttori == 2 and p.numberg == 6: self.corruttorig6 = 2 if p.corruttori == 3 and p.numberg == 6: self.corruttorig6 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 7: self.corruttorig7 = 0 if p.corruttori == 1 and p.numberg == 7: self.corruttorig7 = 1 if p.corruttori == 2 and p.numberg == 7: self.corruttorig7 = 2 if p.corruttori == 3 and p.numberg == 7: self.corruttorig7 = 3 for p in self.get_players(): if p.corruttori == 0 and p.numberg == 8: self.corruttorig8 = 0 if p.corruttori == 1 and p.numberg == 8: self.corruttorig8 = 1 if p.corruttori == 2 and p.numberg == 8: self.corruttorig8 = 2 if p.corruttori == 3 and p.numberg == 8: self.corruttorig8 = 3 def my_method(self): for p in self.get_players(): if p.numberpl == 2 and p.numberg == 5: self.partecipantipg5 = p.partecipantipg5 if p.numberpl == 3 and p.numberg == 5: self.partecipantipg5 = p.partecipantipg5 if p.numberpl == 1 and p.numberg == 5: self.partecipantipg5 = p.partecipantipg5 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 4: self.partecipantipg4 = p.partecipantipg4 if p.numberpl == 3 and p.numberg == 4: self.partecipantipg4 = p.partecipantipg4 if p.numberpl == 1 and p.numberg == 4: self.partecipantipg4 = p.partecipantipg4 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 3: self.partecipantipg3 = p.partecipantipg3 if p.numberpl == 3 and p.numberg == 3: self.partecipantipg3 = p.partecipantipg3 if p.numberpl == 1 and p.numberg == 3: self.partecipantipg3 = p.partecipantipg3 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 2: self.partecipantipg2 = p.partecipantipg2 if p.numberpl == 3 and p.numberg == 2: self.partecipantipg2 = p.partecipantipg2 if p.numberpl == 1 and p.numberg == 2: self.partecipantipg2 = p.partecipantipg2 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 1: self.partecipantipg1 = p.partecipantipg1 if p.numberpl == 3 and p.numberg == 1: self.partecipantipg1 = p.partecipantipg1 if p.numberpl == 1 and p.numberg == 1: self.partecipantipg1 = p.partecipantipg1 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 6: self.partecipantipg6 = p.partecipantipg6 if p.numberpl == 3 and p.numberg == 6: self.partecipantipg6 = p.partecipantipg6 if p.numberpl == 1 and p.numberg == 6: self.partecipantipg6 = p.partecipantipg6 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 7: self.partecipantipg7 = p.partecipantipg7 if p.numberpl == 3 and p.numberg == 7: self.partecipantipg7 = p.partecipantipg7 if p.numberpl == 1 and p.numberg == 7: self.partecipantipg7 = p.partecipantipg7 for p in self.get_players(): if p.numberpl == 2 and p.numberg == 8: self.partecipantipg8 = p.partecipantipg8 if p.numberpl == 3 and p.numberg == 8: self.partecipantipg8 = p.partecipantipg8 if p.numberpl == 1 and p.numberg == 8: self.partecipantipg8 = p.partecipantipg8 def my_method2(self): if self.in_round(self.round_number - 1).partecipantipg1 == None: pass else: self.partecipantiprima1 = self.in_round(self.round_number - 1).partecipantipg1 if self.in_round(self.round_number - 1).partecipantipg2 == None: pass else: self.partecipantiprima2 = self.in_round(self.round_number - 1).partecipantipg2 if self.in_round(self.round_number - 1).partecipantipg3 == None: pass else: self.partecipantiprima3 = self.in_round(self.round_number - 1).partecipantipg3 if self.in_round(self.round_number - 1).partecipantipg4 == None: pass else: self.partecipantiprima4 = self.in_round(self.round_number - 1).partecipantipg4 if self.in_round(self.round_number - 1).partecipantipg5 == None: pass else: self.partecipantiprima5 = self.in_round(self.round_number - 1).partecipantipg5 if self.in_round(self.round_number - 1).partecipantipg6 == None: pass else: self.partecipantiprima6 = self.in_round(self.round_number - 1).partecipantipg6 if self.in_round(self.round_number - 1).partecipantipg7 == None: pass else: self.partecipantiprima7 = self.in_round(self.round_number - 1).partecipantipg7 if self.in_round(self.round_number - 1).partecipantipg8 == None: pass else: self.partecipantiprima8 = self.in_round(self.round_number - 1).partecipantipg8 class Group(BaseGroup): partecipanti = models.IntegerField() umpirelastgroup = models.IntegerField() total_contribution = models.CurrencyField() individual_share = models.CurrencyField() def after_all_players_arrive(self): #creazione delle stringhe p1 = self.get_player_by_id(1) p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) #stringhe x arbitro e x comprare info for p in self.get_players(): p.progettocomune = None if p.contribution == None: pass if p.contribution == 99: p.progettocomune = "Exit" if p.contribution == 0: p.progettocomune = "0 points" if p.contribution == 3: p.progettocomune = "3 points" if p.contribution == 6: p.progettocomune = "6 points" if p.contribution == 9: p.progettocomune = "9 points" if p.contribution == 100: p.progettocomune = "0 points and 2 points to the umpire" if p.contribution == 300: p.progettocomune = "3 points and 1 point to the umpire" #stringhe x feedback da mostrare al player 2 (non faccio vedere le bribe) for p in self.get_players(): if p3.progettocomune == "Exit": p2.progettocomunepl3 = "Exit" if p3.progettocomune == "0 points": p2.progettocomunepl3 = "0 points" if p3.progettocomune == "3 points": p2.progettocomunepl3 = "3 points" if p3.progettocomune == "6 points": p2.progettocomunepl3 = "6 points" if p3.progettocomune == "9 points": p2.progettocomunepl3 = "9 points" if p3.progettocomune == "0 points and 2 points to the umpire": p2.progettocomunepl3 = "0 points" if p3.progettocomune == "3 points and 1 point to the umpire": p2.progettocomunepl3 = "3 points" if p1.progettocomune == "Exit": p2.progettocomunepl1 = "Exit" if p1.progettocomune == "0 points": p2.progettocomunepl1 = "0 points" if p1.progettocomune == "3 points": p2.progettocomunepl1 = "3 points" if p1.progettocomune == "6 points": p2.progettocomunepl1 = "6 points" if p1.progettocomune == "9 points": p2.progettocomunepl1 = "9 points" if p1.progettocomune == "0 points and 2 points to the umpire": p2.progettocomunepl1 = "0 points" if p1.progettocomune == "3 points and 1 point to the umpire": p2.progettocomunepl1 = "3 points" #stringhe x feedback da mostrare al player 3 (non faccio vedere le bribe) if p2.progettocomune == "Exit": p3.progettocomunepl2 = "Exit" if p2.progettocomune == "0 points": p3.progettocomunepl2 = "0 points" if p2.progettocomune == "3 points": p3.progettocomunepl2 = "3 points" if p2.progettocomune == "6 points": p3.progettocomunepl2 = "6 points" if p2.progettocomune == "9 points": p3.progettocomunepl2 = "9 points" if p2.progettocomune == "0 points and 2 points to the umpire": p3.progettocomunepl2 = "0 points" if p2.progettocomune == "3 points and 1 point to the umpire": p3.progettocomunepl2 = "3 points" if p1.progettocomune == "Exit": p3.progettocomunepl1 = "Exit" if p1.progettocomune == "0 points": p3.progettocomunepl1 = "0 points" if p1.progettocomune == "3 points": p3.progettocomunepl1 = "3 points" if p1.progettocomune == "6 points": p3.progettocomunepl1 = "6 points" if p1.progettocomune == "9 points": p3.progettocomunepl1 = "9 points" if p1.progettocomune == "0 points and 2 points to the umpire": p3.progettocomunepl1 = "0 points" if p1.progettocomune == "3 points and 1 point to the umpire": p3.progettocomunepl1 = "3 points" #stringhe x feedback da mostrare al player 1 (non faccio vedere le bribe) if p2.progettocomune == "Exit": p1.progettocomunepl2 = "Exit" if p2.progettocomune == "0 points": p1.progettocomunepl2 = "0 points" if p2.progettocomune == "3 points": p1.progettocomunepl2 = "3 points" if p2.progettocomune == "6 points": p1.progettocomunepl2 = "6 points" if p2.progettocomune == "9 points": p1.progettocomunepl2 = "9 points" if p2.progettocomune == "0 points and 2 points to the umpire": p1.progettocomunepl2 = "0 points" if p2.progettocomune == "3 points and 1 point to the umpire": p1.progettocomunepl2 = "3 points" if p3.progettocomune == "Exit": p1.progettocomunepl3 = "Exit" if p3.progettocomune == "0 points": p1.progettocomunepl3 = "0 points" if p3.progettocomune == "3 points": p1.progettocomunepl3 = "3 points" if p3.progettocomune == "6 points": p1.progettocomunepl3 = "6 points" if p3.progettocomune == "9 points": p1.progettocomunepl3 = "9 points" if p3.progettocomune == "0 points and 2 points to the umpire": p1.progettocomunepl3 = "0 points" if p3.progettocomune == "3 points and 1 point to the umpire": p1.progettocomunepl3 = "3 points" if self.id_in_subsession == 1: p1.numberg = 1 p2.numberg = 1 p3.numberg = 1 elif self.id_in_subsession == 2: p1.numberg = 2 p2.numberg = 2 p3.numberg = 2 elif self.id_in_subsession == 3: p1.numberg = 3 p2.numberg = 3 p3.numberg = 3 elif self.id_in_subsession == 4: p1.numberg = 4 p2.numberg = 4 p3.numberg = 4 elif self.id_in_subsession == 5: p1.numberg = 5 p2.numberg = 5 p3.numberg = 5 elif self.id_in_subsession == 6: p1.numberg = 6 p2.numberg = 6 p3.numberg = 6 elif self.id_in_subsession == 7: p1.numberg = 7 p2.numberg = 7 p3.numberg = 7 elif self.id_in_subsession == 8: p1.numberg = 8 p2.numberg = 8 p3.numberg = 8 if self.get_player_by_id(1): p1.numberpl = 1 if self.get_player_by_id(2): p2.numberpl = 2 if self.get_player_by_id(3): p3.numberpl = 3 for p in self.get_players(): if p.Info == None: p.infostringa = "No" if p.Info == True: p.infostringa = "Si" else: p.infostringa = "No" partecipanti= 0 for p in self.get_players(): if p.contribution == 99: pass elif p.contribution == None: pass else: partecipanti = partecipanti + 1 p1.partecipantipg = partecipanti p2.partecipantipg = partecipanti p3.partecipantipg = partecipanti def set_payoff1(self): #payoff HONEST NO INFO; round 1 #eliminazione giocatori che escono, conversione variabili 100 e 300 in "0 e 2 bribe" e "3 e 1 bribe" contributions = 0 partecipanti= 0 bribe= 0 for p in self.get_players(): if p.contribution == 99: pass elif p.contribution == None: pass elif p.contribution == 100: partecipanti = partecipanti + 1 contributions = contributions + 0 bribe = bribe + 2 elif p.contribution == 300: partecipanti = partecipanti + 1 contributions = contributions + 3 bribe = bribe + 1 else: partecipanti = partecipanti + 1 contributions = contributions + p.contribution #punizioni for p in self.get_players(): if partecipanti > 1: if p.contribution == 100: p.punizione = 11 elif p.contribution == 300: p.punizione = 7 elif p.contribution == 0: p.punizione = 11 elif p.contribution == 3: p.punizione = 7 else: p.punizione = 0 else: p.punizione = 0 if partecipanti > 0: self.total_contribution= contributions * 2 self.individual_share = self.total_contribution / partecipanti if partecipanti == 1: self.total_contribution = 0 self.individual_share = 0 if partecipanti == 0: self.total_contribution= 0 self.individual_share = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == 99: p.payoff = Constants.Endowment elif p.contribution == 100: p.payoff = Constants.Endowment + self.individual_share - 2 - p.punizione elif p.contribution == 300: p.payoff = Constants.Endowment + self.individual_share - 4 - p.punizione else: p.payoff = Constants.Endowment - p.contribution + self.individual_share - p.punizione else: p.payoff = Constants.Endowment corruzione = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == 100: corruzione = corruzione + 0 if p.contribution == 300: corruzione = corruzione + 0 else: corruzione = corruzione + 0 else: corruzione = corruzione + 0 p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) p1 = self.get_player_by_id(1) p1.corruzione = corruzione p2.corruzione = corruzione p3.corruzione = corruzione p1.partecipantipg = partecipanti p2.partecipantipg = partecipanti p3.partecipantipg = partecipanti corruttori = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == None: pass if p.contribution == 100: corruttori = corruttori + 1 if p.contribution == 300: corruttori = corruttori + 1 if p.contribution == 3: corruttori = corruttori + 0 if p.contribution == 6: corruttori = corruttori + 0 if p.contribution == 9: corruttori = corruttori + 0 if p.contribution == 99: corruttori = corruttori + 0 else: corruttori = corruttori + 0 p1.corruttori = corruttori p2.corruttori = corruttori p3.corruttori = corruttori def set_payoffONEST(self): #payoff round > 1 and honest umpire contributions = 0 partecipanti= 0 bribe = 0 for p in self.get_players(): if p.contribution == 99: pass elif p.contribution == None: pass elif p.contribution == 100: partecipanti = partecipanti + 1 contributions = contributions + 0 bribe = bribe + 2 elif p.contribution == 300: partecipanti = partecipanti + 1 contributions = contributions + 3 bribe = bribe + 1 else: partecipanti = partecipanti + 1 contributions = contributions + p.contribution if partecipanti > 0: self.total_contribution= contributions * 2 self.individual_share = self.total_contribution / partecipanti if partecipanti == 1: self.total_contribution = 0 self.individual_share = 0 if partecipanti == 0: self.total_contribution= 0 self.individual_share = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == 100: p.punizione = 11 elif p.contribution == 300: p.punizione = 7 elif p.contribution == 0: p.punizione = 11 elif p.contribution == 3: p.punizione = 7 else: p.punizione = 0 else: p.punizione = 0 p.mazzetta = bribe for p in self.get_players(): if partecipanti > 1 : if p.contribution == 99 and p.Info == True : p.payoff = Constants.Endowment - Constants.Infocost elif p.contribution == 99 and p.Info == False: p.payoff = Constants.Endowment elif p.contribution == 100 and p.Info == True: p.payoff = Constants.Endowment + self.individual_share - 2 - p.punizione - Constants.Infocost elif p.contribution == 100 and p.Info == False: p.payoff = Constants.Endowment + self.individual_share - 2 - p.punizione elif p.contribution == 300 and p.Info == True: p.payoff = Constants.Endowment + self.individual_share - 4 - p.punizione - Constants.Infocost elif p.contribution == 300 and p.Info == False: p.payoff = Constants.Endowment + self.individual_share - 4 - p.punizione elif p.Info == True: p.payoff = Constants.Endowment + self.individual_share - p.contribution - p.punizione - Constants.Infocost else: p.payoff = Constants.Endowment + self.individual_share - p.contribution - p.punizione else: if p.Info == True: p.payoff = Constants.Endowment - Constants.Infocost else: p.payoff = Constants.Endowment corruzione = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == 100: corruzione = corruzione + 0 if p.contribution == 300: corruzione = corruzione + 0 else: corruzione = corruzione + 0 else: corruzione = corruzione + 0 p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) p1 = self.get_player_by_id(1) p1.corruzione = corruzione p2.corruzione = corruzione p3.corruzione = corruzione p1.partecipantipg = partecipanti p2.partecipantipg = partecipanti p3.partecipantipg = partecipanti corruttori = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == None: pass if p.contribution == 100: corruttori = corruttori + 1 if p.contribution == 300: corruttori = corruttori + 1 if p.contribution == 3: corruttori = corruttori + 0 if p.contribution == 6: corruttori = corruttori + 0 if p.contribution == 9: corruttori = corruttori + 0 if p.contribution == 99: corruttori = corruttori + 0 else: corruttori = corruttori + 0 p1.corruttori = corruttori p2.corruttori = corruttori p3.corruttori = corruttori def punizioni_gruppi(self): #registro le punizioni per poterle ripescare al momento dell'acquisto dell'info p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) p1 = self.get_player_by_id(1) #punizioni gruppo 1 for p in self.get_players(): if p2.numberg == 1 and p2.punizione == 0: p.punizgruppo1pl2 = "0 points" if p2.numberg == 1 and p2.punizione == 7: p.punizgruppo1pl2 = "7 points" if p2.numberg == 1 and p2.punizione == 11: p.punizgruppo1pl2 = "11 points" for p in self.get_players(): if p3.numberg == 1 and p3.punizione == 0: p.punizgruppo1pl3 = "0 points" if p3.numberg == 1 and p3.punizione == 7: p.punizgruppo1pl3 = "7 points" if p3.numberg == 1 and p3.punizione == 11: p.punizgruppo1pl3 = "11 points" for p in self.get_players(): if p1.numberg == 1 and p1.punizione == 0: p.punizgruppo1pl1 = "0 points" if p1.numberg == 1 and p1.punizione == 7: p.punizgruppo1pl1 = "7 points" if p1.numberg == 1 and p1.punizione == 11: p.punizgruppo1pl1 = "11 points" #puizioni gruppo 2 for p in self.get_players(): if p2.numberg == 2 and p2.punizione == 0: p.punizgruppo2pl2 = "0 points" if p2.numberg == 2 and p2.punizione == 7: p.punizgruppo2pl2 = "7 points" if p2.numberg == 2 and p2.punizione == 11: p.punizgruppo2pl2 = "11 points" for p in self.get_players(): if p3.numberg == 2 and p3.punizione == 0: p.punizgruppo2pl3 = "0 points" if p3.numberg == 2 and p3.punizione == 7: p.punizgruppo2pl3 = "7 points" if p3.numberg == 2 and p3.punizione == 11: p.punizgruppo2pl3 = "11 points" for p in self.get_players(): if p1.numberg == 2 and p1.punizione == 0: p.punizgruppo2pl1 = "0 points" if p1.numberg == 2 and p1.punizione == 7: p.punizgruppo2pl1 = "7 points" if p1.numberg == 2 and p1.punizione == 11: p.punizgruppo2pl1 = "11 points" #puizioni passate gruppo 3 for p in self.get_players(): if p2.numberg == 3 and p2.punizione == 0: p.punizgruppo3pl2 = "0 points" if p2.numberg == 3 and p2.punizione == 7: p.punizgruppo3pl2 = "7 points" if p2.numberg == 3 and p2.punizione == 11: p.punizgruppo3pl2 = "11 points" for p in self.get_players(): if p3.numberg == 3 and p3.punizione == 0: p.punizgruppo3pl3 = "0 points" if p3.numberg == 3 and p3.punizione == 7: p.punizgruppo3pl3 = "7 points" if p3.numberg == 3 and p3.punizione == 11: p.punizgruppo3pl3 = "11 points" for p in self.get_players(): if p1.numberg == 3 and p1.punizione == 0: p.punizgruppo3pl1 = "0 points" if p1.numberg == 3 and p1.punizione == 7: p.punizgruppo3pl1 = "7 points" if p1.numberg == 3 and p1.punizione == 11: p.punizgruppo3pl1 = "11 points" #puizioni passate gruppo 4 for p in self.get_players(): if p2.numberg == 4 and p2.punizione == 0: p.punizgruppo4pl2 = "0 points" if p2.numberg == 4 and p2.punizione == 7: p.punizgruppo4pl2 = "7 points" if p2.numberg == 4 and p2.punizione == 11: p.punizgruppo4pl2 = "11 points" for p in self.get_players(): if p3.numberg == 4 and p3.punizione == 0: p.punizgruppo4pl3 = "0 points" if p3.numberg == 4 and p3.punizione == 7: p.punizgruppo4pl3 = "7 points" if p3.numberg == 4 and p3.punizione == 11: p.punizgruppo4pl3 = "11 points" for p in self.get_players(): if p1.numberg == 4 and p1.punizione == 0: p.punizgruppo4pl1 = "0 points" if p1.numberg == 4 and p1.punizione == 7: p.punizgruppo4pl1 = "7 points" if p1.numberg == 4 and p1.punizione == 11: p.punizgruppo4pl1 = "11 points" #puizioni passate gruppo 5 for p in self.get_players(): if p2.numberg == 5 and p2.punizione == 0: p.punizgruppo5pl2 = "0 points" if p2.numberg == 5 and p2.punizione == 7: p.punizgruppo5pl2 = "7 points" if p2.numberg == 5 and p2.punizione == 11: p.punizgruppo5pl2 = "11 points" for p in self.get_players(): if p3.numberg == 5 and p3.punizione == 0: p.punizgruppo5pl3 = "0 points" if p3.numberg == 5 and p3.punizione == 7: p.punizgruppo5pl3 = "7 points" if p3.numberg == 5 and p3.punizione == 11: p.punizgruppo5pl3 = "11 points" for p in self.get_players(): if p1.numberg == 5 and p1.punizione == 0: p.punizgruppo5pl1 = "0 points" if p1.numberg == 5 and p1.punizione == 7: p.punizgruppo5pl1 = "7 points" if p1.numberg == 5 and p1.punizione == 11: p.punizgruppo5pl1 = "11 points" #puizioni passate gruppo 5 for p in self.get_players(): if p2.numberg == 5 and p2.punizione == 0: p.punizgruppo5pl2 = "0 points" if p2.numberg == 5 and p2.punizione == 7: p.punizgruppo5pl2 = "7 points" if p2.numberg == 5 and p2.punizione == 11: p.punizgruppo5pl2 = "11 points" for p in self.get_players(): if p3.numberg == 5 and p3.punizione == 0: p.punizgruppo5pl3 = "0 points" if p3.numberg == 5 and p3.punizione == 7: p.punizgruppo5pl3 = "7 points" if p3.numberg == 5 and p3.punizione == 11: p.punizgruppo5pl3 = "11 points" for p in self.get_players(): if p1.numberg == 5 and p1.punizione == 0: p.punizgruppo5pl1 = "0 points" if p1.numberg == 5 and p1.punizione == 7: p.punizgruppo5pl1 = "7 points" if p1.numberg == 5 and p1.punizione == 11: p.punizgruppo5pl1 = "11 points" #puizioni passate gruppo 6 for p in self.get_players(): if p2.numberg == 6 and p2.punizione == 0: p.punizgruppo6pl2 = "0 points" if p2.numberg == 6 and p2.punizione == 7: p.punizgruppo6pl2 = "7 points" if p2.numberg == 6 and p2.punizione == 11: p.punizgruppo6pl2 = "11 points" for p in self.get_players(): if p3.numberg == 6 and p3.punizione == 0: p.punizgruppo6pl3 = "0 points" if p3.numberg == 6 and p3.punizione == 7: p.punizgruppo6pl3 = "7 points" if p3.numberg == 6 and p3.punizione == 11: p.punizgruppo6pl3 = "11 points" for p in self.get_players(): if p1.numberg == 6 and p1.punizione == 0: p.punizgruppo6pl1 = "0 points" if p1.numberg == 6 and p1.punizione == 7: p.punizgruppo6pl1 = "7 points" if p1.numberg == 6 and p1.punizione == 11: p.punizgruppo6pl1 = "11 points" #puizioni passate gruppo 7 for p in self.get_players(): if p2.numberg == 7 and p2.punizione == 0: p.punizgruppo7pl2 = "0 punti" if p2.numberg == 7 and p2.punizione == 7: p.punizgruppo7pl2 = "7 punti" if p2.numberg == 7 and p2.punizione == 11: p.punizgruppo7pl2 = "11 punti" for p in self.get_players(): if p3.numberg == 7 and p3.punizione == 0: p.punizgruppo7pl3 = "0 points" if p3.numberg == 7 and p3.punizione == 7: p.punizgruppo7pl3 = "7 points" if p3.numberg == 7 and p3.punizione == 11: p.punizgruppo7pl3 = "11 points" for p in self.get_players(): if p1.numberg == 7 and p1.punizione == 0: p.punizgruppo7pl1 = "0 points" if p1.numberg == 7 and p1.punizione == 7: p.punizgruppo7pl1 = "7 points" if p1.numberg == 7 and p1.punizione == 11: p.punizgruppo7pl1 = "11 points" #puizioni passate gruppo 8 for p in self.get_players(): if p2.numberg == 8 and p2.punizione == 0: p.punizgruppo8pl2 = "0 points" if p2.numberg == 8 and p2.punizione == 7: p.punizgruppo8pl2 = "7 points" if p2.numberg == 8 and p2.punizione == 11: p.punizgruppo8pl2 = "11 points" for p in self.get_players(): if p3.numberg == 8 and p3.punizione == 0: p.punizgruppo8pl3 = "0 points" if p3.numberg == 8 and p3.punizione == 7: p.punizgruppo8pl3 = "7 points" if p3.numberg == 8 and p3.punizione == 11: p.punizgruppo8pl3 = "11 points" for p in self.get_players(): if p1.numberg == 8 and p1.punizione == 0: p.punizgruppo8pl1 = "0 points" if p1.numberg == 8 and p1.punizione == 7: p.punizgruppo8pl1 = "7 points" if p1.numberg == 8 and p1.punizione == 11: p.punizgruppo8pl1 = "11 points" def umpire(self): #arbitri: 1 corrupt, 0 honest for p in self.get_players(): if self.round_number > 5: p.umpire = 1 else: p.umpire = 0 p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) p1 = self.get_player_by_id(1) for p in self.get_players(): if self.id_in_subsession == 1: p1.numberg = 1 p2.numberg = 1 p3.numberg = 1 elif self.id_in_subsession == 2: p1.numberg = 2 p2.numberg = 2 p3.numberg = 2 elif self.id_in_subsession == 3: p1.numberg = 3 p2.numberg = 3 p3.numberg = 3 elif self.id_in_subsession == 4: p1.numberg = 4 p2.numberg = 4 p3.numberg = 4 elif self.id_in_subsession == 5: p1.numberg = 5 p2.numberg = 5 p3.numberg = 5 elif self.id_in_subsession == 6: p1.numberg = 6 p2.numberg = 6 p3.numberg = 6 elif self.id_in_subsession == 7: p1.numberg = 7 p2.numberg = 7 p3.numberg = 7 elif self.id_in_subsession == 8: p1.numberg = 8 p2.numberg = 8 p3.numberg = 8 if self.get_player_by_id(1): p1.numberpl = 1 if self.get_player_by_id(2): p2.numberpl = 2 if self.get_player_by_id(3): p3.numberpl = 3 def randomgroup(self): #import random #value = random.randint(0, 7) for p in self.get_players(): p.value = 0 p.randomgroup = 0 # if value == 1: # p.randomgroup = 1 # if value == 2: # p.randomgroup = 2 # if value == 3: # p.randomgroup = 3 # if value == 4: # p.randomgroup = 4 # if value == 5: # p.randomgroup = 5 # if value == 6: # p.randomgroup = 6 # if value == 7: # p.randomgroup =7 def giocate(self): p1 = self.get_player_by_id(1) p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) # registro le giocate gruppo 1 for p in self.get_players(): if p2.numberg == 1 and p2.contribution == 99: p.gruppo1pl2 = "Exit" if p2.numberg == 1 and p2.contribution == 0: p.gruppo1pl2 = "0 points" if p2.numberg == 1 and p2.contribution == 3: p.gruppo1pl2 = "3 points" if p2.numberg == 1 and p2.contribution == 6: p.gruppo1pl2 = "6 points" if p2.numberg == 1 and p2.contribution == 9: p.gruppo1pl2 = "9 points" if p2.numberg == 1 and p2.contribution == 100: p.gruppo1pl2 = "0 points and 2 points to the umpire" if p2.numberg == 1 and p2.contribution == 300: p.gruppo1pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 1 and p3.contribution == 99: p.gruppo1pl3 = "Exit" if p3.numberg == 1 and p3.contribution == 0: p.gruppo1pl3 = "0 points" if p3.numberg == 1 and p3.contribution == 3: p.gruppo1pl3 = "3 points" if p3.numberg == 1 and p3.contribution == 6: p.gruppo1pl3 = "6 points" if p3.numberg == 1 and p3.contribution == 9: p.gruppo1pl3 = "9 points" if p3.numberg == 1 and p3.contribution == 100: p.gruppo1pl3 = "0 points and 2 points to the umpire" if p3.numberg == 1 and p3.contribution == 300: p.gruppo1pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 1 and p1.contribution == 99: p.gruppo1pl1 = "Exit" if p1.numberg == 1 and p1.contribution == 0: p.gruppo1pl1 = "0 points" if p1.numberg == 1 and p1.contribution == 3: p.gruppo1pl1 = "3 points" if p1.numberg == 1 and p1.contribution == 6: p.gruppo1pl1 = "6 points" if p1.numberg == 1 and p1.contribution == 9: p.gruppo1pl1 = "9 points" if p1.numberg == 1 and p1.contribution == 100: p.gruppo1pl1 = "0 points and 2 points to the umpire" if p1.numberg == 1 and p1.contribution == 300: p.gruppo1pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 2 for p in self.get_players(): if p2.numberg == 2 and p2.contribution == 99: p.gruppo2pl2 = "Exit" if p2.numberg == 2 and p2.contribution == 0: p.gruppo2pl2 = "0 points" if p2.numberg == 2 and p2.contribution == 3: p.gruppo2pl2 = "3 points" if p2.numberg == 2 and p2.contribution == 6: p.gruppo2pl2 = "6 points" if p2.numberg == 2 and p2.contribution == 9: p.gruppo2pl2 = "9 points" if p2.numberg == 2 and p2.contribution == 100: p.gruppo2pl2 = "0 points and 2 points to the umpire" if p2.numberg == 2 and p2.contribution == 300: p.gruppo2pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 2 and p3.contribution == 99: p.gruppo2pl3 = "Exit" if p3.numberg == 2 and p3.contribution == 0: p.gruppo2pl3 = "0 points" if p3.numberg == 2 and p3.contribution == 3: p.gruppo2pl3 = "3 points" if p3.numberg == 2 and p3.contribution == 6: p.gruppo2pl3 = "6 points" if p3.numberg == 2 and p3.contribution == 9: p.gruppo2pl3 = "9 points" if p3.numberg == 2 and p3.contribution == 100: p.gruppo2pl3 = "0 points and 2 points to the umpire" if p3.numberg == 2 and p3.contribution == 300: p.gruppo2pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 2 and p1.contribution == 99: p.gruppo2pl1 = "Exit" if p1.numberg == 2 and p1.contribution == 0: p.gruppo2pl1 = "0 points" if p1.numberg == 2 and p1.contribution == 3: p.gruppo2pl1 = "3 points" if p1.numberg == 2 and p1.contribution == 6: p.gruppo2pl1 = "6 points" if p1.numberg == 2 and p1.contribution == 9: p.gruppo2pl1 = "9 points" if p1.numberg == 2 and p1.contribution == 100: p.gruppo2pl1 = "0 points and 2 points to the umpire" if p1.numberg == 2 and p1.contribution == 300: p.gruppo2pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 3 for p in self.get_players(): if p2.numberg == 3 and p2.contribution == 99: p.gruppo3pl2 = "Exit" if p2.numberg == 3 and p2.contribution == 0: p.gruppo3pl2 = "0 points" if p2.numberg == 3 and p2.contribution == 3: p.gruppo3pl2 = "3 points" if p2.numberg == 3 and p2.contribution == 6: p.gruppo3pl2 = "6 points" if p2.numberg == 3 and p2.contribution == 9: p.gruppo3pl2 = "9 points" if p2.numberg == 3 and p2.contribution == 100: p.gruppo3pl2 = "0 points and 2 points to the umpire" if p2.numberg == 3 and p2.contribution == 300: p.gruppo3pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 3 and p3.contribution == 99: p.gruppo3pl3 = "Exit" if p3.numberg == 3 and p3.contribution == 0: p.gruppo3pl3 = "0 points" if p2.numberg == 3 and p3.contribution == 3: p.gruppo3pl3 = "3 points" if p3.numberg == 3 and p3.contribution == 6: p.gruppo3pl3 = "6 points" if p3.numberg == 3 and p3.contribution == 9: p.gruppo3pl3 = "9 points" if p3.numberg == 3 and p3.contribution == 100: p.gruppo3pl3 = "0 points and 2 points to the umpire" if p3.numberg == 3 and p3.contribution == 300: p.gruppo3pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 3 and p1.contribution == 99: p.gruppo3pl1 = "Exit" if p1.numberg == 3 and p1.contribution == 0: p.gruppo3pl1 = "0 points" if p1.numberg == 3 and p1.contribution == 3: p.gruppo3pl1 = "3 points" if p1.numberg == 3 and p1.contribution == 6: p.gruppo3pl1 = "6 points" if p1.numberg == 3 and p1.contribution == 9: p.gruppo3pl1 = "9 points" if p1.numberg == 3 and p1.contribution == 100: p.gruppo3pl1 = "0 points and 2 points to the umpire" if p1.numberg == 3 and p1.contribution == 300: p.gruppo3pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 4 for p in self.get_players(): if p2.numberg == 4 and p2.contribution == 99: p.gruppo4pl2 = "Exit" if p2.numberg == 4 and p2.contribution == 0: p.gruppo4pl2 = "0 points" if p2.numberg == 4 and p2.contribution == 3: p.gruppo4pl2 = "3 points" if p2.numberg == 4 and p2.contribution == 6: p.gruppo4pl2 = "6 points" if p2.numberg == 4 and p2.contribution == 9: p.gruppo4pl2 = "9 points" if p2.numberg == 4 and p2.contribution == 100: p.gruppo4pl2 = "0 points and 2 points to the umpire" if p2.numberg == 4 and p2.contribution == 300: p.gruppo4pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 4 and p3.contribution == 99: p.gruppo4pl3 = "Exit" if p3.numberg == 4 and p3.contribution == 0: p.gruppo4pl3 = "0 points" if p2.numberg == 4 and p3.contribution == 3: p.gruppo4pl3 = "3 points" if p3.numberg == 4 and p3.contribution == 6: p.gruppo4pl3 = "6 points" if p3.numberg == 4 and p3.contribution == 9: p.gruppo4pl3 = "9 points" if p3.numberg == 4 and p3.contribution == 100: p.gruppo4pl3 = "0 points and 2 points to the umpire" if p3.numberg == 4 and p3.contribution == 300: p.gruppo4pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 4 and p1.contribution == 99: p.gruppo4pl1 = "Exit" if p1.numberg == 4 and p1.contribution == 0: p.gruppo4pl1 = "0 points" if p1.numberg == 4 and p1.contribution == 3: p.gruppo4pl1 = "3 points" if p1.numberg == 4 and p1.contribution == 6: p.gruppo4pl1 = "6 points" if p1.numberg == 4 and p1.contribution == 9: p.gruppo4pl1 = "9 points" if p1.numberg == 4 and p1.contribution == 100: p.gruppo4pl1 = "0 points and 2 points to the umpire" if p1.numberg == 4 and p1.contribution == 300: p.gruppo4pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 5 for p in self.get_players(): if p2.numberg == 5 and p2.contribution == 99: p.gruppo5pl2 = "Exit" if p2.numberg == 5 and p2.contribution == 0: p.gruppo5pl2 = "0 points" if p2.numberg == 5 and p2.contribution == 3: p.gruppo5pl2 = "3 points" if p2.numberg == 5 and p2.contribution == 6: p.gruppo5pl2 = "6 points" if p2.numberg == 5 and p2.contribution == 9: p.gruppo5pl2 = "9 points" if p2.numberg == 5 and p2.contribution == 100: p.gruppo5pl2 = "0 points and 2 points to the umpire" if p2.numberg == 5 and p2.contribution == 300: p.gruppo5pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 5 and p3.contribution == 99: p.gruppo5pl3 = "Exit" if p3.numberg == 5 and p3.contribution == 0: p.gruppo5pl3 = "0 points" if p2.numberg == 5 and p3.contribution == 3: p.gruppo5pl3 = "3 points" if p3.numberg == 5 and p3.contribution == 6: p.gruppo5pl3 = "6 points" if p3.numberg == 5 and p3.contribution == 9: p.gruppo5pl3 = "9 points" if p3.numberg == 5 and p3.contribution == 100: p.gruppo5pl3 = "0 points and 2 points to the umpire" if p3.numberg == 5 and p3.contribution == 300: p.gruppo5pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 5 and p1.contribution == 99: p.gruppo5pl1 = "Exit" if p1.numberg == 5 and p1.contribution == 0: p.gruppo5pl1 = "0 points" if p1.numberg == 5 and p1.contribution == 3: p.gruppo5pl1 = "3 points" if p1.numberg == 5 and p1.contribution == 6: p.gruppo5pl1 = "6 points" if p1.numberg == 5 and p1.contribution == 9: p.gruppo5pl1 = "9 points" if p1.numberg == 5 and p1.contribution == 100: p.gruppo5pl1 = "0 points and 2 points to the umpire" if p1.numberg == 5 and p1.contribution == 300: p.gruppo5pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 6 for p in self.get_players(): if p2.numberg == 6 and p2.contribution == 99: p.gruppo6pl2 = "Exit" if p2.numberg == 6 and p2.contribution == 0: p.gruppo6pl2 = "0 points" if p2.numberg == 6 and p2.contribution == 3: p.gruppo6pl2 = "3 points" if p2.numberg == 6 and p2.contribution == 6: p.gruppo6pl2 = "6 points" if p2.numberg == 6 and p2.contribution == 9: p.gruppo6pl2 = "9 points" if p2.numberg == 6 and p2.contribution == 100: p.gruppo6pl2 = "0 points and 2 points to the umpire" if p2.numberg == 6 and p2.contribution == 300: p.gruppo6pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 6 and p3.contribution == 99: p.gruppo6pl3 = "Exit" if p3.numberg == 6 and p3.contribution == 0: p.gruppo6pl3 = "0 points" if p2.numberg == 6 and p3.contribution == 3: p.gruppo6pl3 = "3 points" if p3.numberg == 6 and p3.contribution == 6: p.gruppo6pl3 = "6 points" if p3.numberg == 6 and p3.contribution == 9: p.gruppo6pl3 = "9 points" if p3.numberg == 6 and p3.contribution == 100: p.gruppo6pl3 = "0 points and 2 points to the umpire" if p3.numberg == 6 and p3.contribution == 300: p.gruppo6pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 6 and p1.contribution == 99: p.gruppo6pl1 = "Exit" if p1.numberg == 6 and p1.contribution == 0: p.gruppo6pl1 = "0 points" if p1.numberg == 6 and p1.contribution == 3: p.gruppo6pl1 = "3 points" if p1.numberg == 6 and p1.contribution == 6: p.gruppo6pl1 = "6 points" if p1.numberg == 6 and p1.contribution == 9: p.gruppo6pl1 = "9 points" if p1.numberg == 6 and p1.contribution == 100: p.gruppo6pl1 = "0 points and 2 points to the umpire" if p1.numberg == 6 and p1.contribution == 300: p.gruppo6pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 7 for p in self.get_players(): if p2.numberg == 7 and p2.contribution == 99: p.gruppo7pl2 = "Exit" if p2.numberg == 7 and p2.contribution == 0: p.gruppo7pl2 = "0 points" if p2.numberg == 7 and p2.contribution == 3: p.gruppo7pl2 = "3 points" if p2.numberg == 7 and p2.contribution == 6: p.gruppo7pl2 = "6 points" if p2.numberg == 7 and p2.contribution == 9: p.gruppo7pl2 = "9 points" if p2.numberg == 7 and p2.contribution == 100: p.gruppo7pl2 = "0 points and 2 points to the umpire" if p2.numberg == 7 and p2.contribution == 300: p.gruppo7pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 7 and p3.contribution == 99: p.gruppo7pl3 = "Exit" if p3.numberg == 7 and p3.contribution == 0: p.gruppo7pl3 = "0 points" if p2.numberg == 7 and p3.contribution == 3: p.gruppo7pl3 = "3 points" if p3.numberg == 7 and p3.contribution == 6: p.gruppo7pl3 = "6 points" if p3.numberg == 7 and p3.contribution == 9: p.gruppo7pl3 = "9 points" if p3.numberg == 7 and p3.contribution == 100: p.gruppo7pl3 = "0 points and 2 points to the umpire" if p3.numberg == 7 and p3.contribution == 300: p.gruppo7pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 7 and p1.contribution == 99: p.gruppo7pl1 = "Exit" if p1.numberg == 7 and p1.contribution == 0: p.gruppo7pl1 = "0 points" if p1.numberg == 7 and p1.contribution == 3: p.gruppo7pl1 = "3 points" if p1.numberg == 7 and p1.contribution == 6: p.gruppo7pl1 = "6 points" if p1.numberg == 7 and p1.contribution == 9: p.gruppo7pl1 = "9 points" if p1.numberg == 7 and p1.pointscontribution == 100: p.gruppo7pl1 = "0 points and 2 points to the umpire" if p1.numberg == 7 and p1.contribution == 300: p.gruppo7pl1 = "3 points and 1 point to the umpire" # registro le giocate gruppo 8 for p in self.get_players(): if p2.numberg == 8 and p2.contribution == 99: p.gruppo8pl2 = "Exit" if p2.numberg == 8 and p2.contribution == 0: p.gruppo8pl2 = "0 points" if p2.numberg == 8 and p2.contribution == 3: p.gruppo8pl2 = "3 points" if p2.numberg == 8 and p2.contribution == 6: p.gruppo8pl2 = "6 points" if p2.numberg == 8 and p2.contribution == 9: p.gruppo8pl2 = "9 points" if p2.numberg == 8 and p2.contribution == 100: p.gruppo8pl2 = "0 points and 2 points to the umpire" if p2.numberg == 8 and p2.contribution == 300: p.gruppo8pl2 = "3 points and 1 point to the umpire" for p in self.get_players(): if p3.numberg == 8 and p3.contribution == 99: p.gruppo8pl3 = "Exit" if p3.numberg == 8 and p3.contribution == 0: p.gruppo8pl3 = "0 points" if p2.numberg == 8 and p3.contribution == 3: p.gruppo8pl3 = "3 points" if p3.numberg == 8 and p3.contribution == 6: p.gruppo8pl3 = "6 points" if p3.numberg == 8 and p3.contribution == 9: p.gruppo8pl3 = "9 points" if p3.numberg == 8 and p3.contribution == 100: p.gruppo8pl3 = "0 points and 2 points to the umpire" if p3.numberg == 8 and p3.contribution == 300: p.gruppo8pl3 = "3 points and 1 point to the umpire" for p in self.get_players(): if p1.numberg == 8 and p1.contribution == 99: p.gruppo8pl1 = "Exit" if p1.numberg == 8 and p1.contribution == 0: p.gruppo8pl1 = "0 points" if p1.numberg == 8 and p1.contribution == 3: p.gruppo8pl1 = "3 points" if p1.numberg == 8 and p1.contribution == 6: p.gruppo8pl1 = "6 points" if p1.numberg == 8 and p1.contribution == 9: p.gruppo8pl1 = "9 points" if p1.numberg == 8 and p1.contribution == 100: p.gruppo8pl1 = "0 points and 2 points to the umpire" if p1.numberg == 8 and p1.contribution == 300: p.gruppo8pl1 = "3 points and 1 point to the umpire" def corr(self): for p in self.get_players(): if p.numberg == 1 and p.corruzione == 0: p.corruzg1 = 0 if p.numberg == 1 and p.corruzione == 1: p.corruzg1 = 1 if p.numberg == 1 and p.corruzione == 2: p.corruzg1 = 2 if p.numberg == 1 and p.corruzione == 3: p.corruzg1 = 3 for p in self.get_players(): if p.numberg == 1 and p.corruttori == 0: p.corruttorig1 = 0 if p.numberg == 1 and p.corruttori == 1: p.corruttorig1 = 1 if p.numberg == 1 and p.corruttori == 2: p.corruttorig1 = 2 if p.numberg == 1 and p.corruttori == 3: p.corruttorig1 = 3 #corruzione e corruttori gruppo for p in self.get_players(): if p.numberg == 2 and p.corruzione == 0: p.corruzg2 = 0 if p.numberg == 2 and p.corruzione == 1: p.corruzg2 = 1 if p.numberg == 2 and p.corruzione == 2: p.corruzg2 = 2 if p.numberg == 2 and p.corruzione == 3: p.corruzg2 = 3 for p in self.get_players(): if p.numberg == 2 and p.corruttori == 0: p.corruttorig2 = 0 if p.numberg == 2 and p.corruttori == 1: p.corruttorig2 = 1 if p.numberg == 2 and p.corruttori == 2: p.corruttorig2 = 2 if p.numberg == 2 and p.corruttori == 3: p.corruttorig2 = 3 #corruzione e corruttori gruppo 3 for p in self.get_players(): if p.numberg == 3 and p.corruzione == 0: p.corruzg3 = 0 if p.numberg == 3 and p.corruzione == 1: p.corruzg3 = 1 if p.numberg == 3 and p.corruzione == 2: p.corruzg3 = 2 if p.numberg == 3 and p.corruzione == 3: p.corruzg3 = 3 for p in self.get_players(): if p.numberg ==3 and p.corruttori == 0: p.corruttorig3 = 0 if p.numberg == 3 and p.corruttori == 1: p.corruttorig3 = 1 if p.numberg == 3 and p.corruttori == 2: p.corruttorig3 = 2 if p.numberg == 3 and p.corruttori == 3: p.corruttorig3 = 3 #corruzione e corruttori gruppo 4 for p in self.get_players(): if p.numberg == 4 and p.corruzione == 0: p.corruzg4 = 0 if p.numberg == 4 and p.corruzione == 1: p.corruzg4 = 1 if p.numberg == 4 and p.corruzione == 2: p.corruzg4 = 2 if p.numberg == 4 and p.corruzione == 3: p.corruzg4 = 3 for p in self.get_players(): if p.numberg == 4 and p.corruttori == 0: p.corruttorig4 = 0 if p.numberg == 4 and p.corruttori == 1: p.corruttorig4 = 1 if p.numberg == 4 and p.corruttori == 2: p.corruttorig4 = 2 if p.numberg == 4 and p.corruttori == 3: p.corruttorig4 = 3 #corruzione e corruttori gruppo 5 for p in self.get_players(): if p.numberg == 5 and p.corruzione == 0: p.corruzg5 = 0 if p.numberg == 5 and p.corruzione == 1: p.corruzg5 = 1 if p.numberg == 5 and p.corruzione == 2: p.corruzg5 = 2 if p.numberg == 5 and p.corruzione == 3: p.corruzg5 = 3 for p in self.get_players(): if p.numberg == 5 and p.corruttori == 0: p.corruttorig5 = 0 if p.numberg == 5 and p.corruttori == 1: p.corruttorig5 = 1 if p.numberg == 5 and p.corruttori == 2: p.corruttorig5 = 2 if p.numberg == 5 and p.corruttori == 3: p.corruttorig5 = 3 #corruzione e corruttori gruppo 6 for p in self.get_players(): if p.numberg == 6 and p.corruzione == 0: p.corruzg6 = 0 if p.numberg == 6 and p.corruzione == 1: p.corruzg6 = 1 if p.numberg == 6 and p.corruzione == 2: p.corruzg6 = 2 if p.numberg == 6 and p.corruzione == 3: p.corruzg6 = 3 for p in self.get_players(): if p.numberg == 6 and p.corruttori == 0: p.corruttorig6 = 0 if p.numberg == 6 and p.corruttori == 1: p.corruttorig6 = 1 if p.numberg == 6 and p.corruttori == 2: p.corruttorig6 = 2 if p.numberg == 6 and p.corruttori == 3: p.corruttorig6 = 3 #corruzione e corruttori gruppo 7 for p in self.get_players(): if p.numberg == 7 and p.corruzione == 0: p.corruzg7 = 0 if p.numberg == 7 and p.corruzione == 1: p.corruzg7 = 1 if p.numberg == 7 and p.corruzione == 2: p.corruzg7 = 2 if p.numberg == 7 and p.corruzione == 3: p.corruzg7 = 3 for p in self.get_players(): if p.numberg == 7 and p.corruttori == 0: p.corruttorig7 = 0 if p.numberg == 7 and p.corruttori == 1: p.corruttorig7 = 1 if p.numberg == 7 and p.corruttori == 2: p.corruttorig7 = 2 if p.numberg == 7 and p.corruttori == 3: p.corruttorig7 = 3 #corruzione e corruttori gruppo 8 for p in self.get_players(): if p.numberg == 8 and p.corruzione == 0: p.corruzg8 = 0 if p.numberg == 8 and p.corruzione == 1: p.corruzg8 = 1 if p.numberg == 8 and p.corruzione == 2: p.corruzg8 = 2 if p.numberg == 8 and p.corruzione == 3: p.corruzg8 = 3 for p in self.get_players(): if p.numberg == 8 and p.corruttori == 0: p.corruttorig8 = 0 if p.numberg == 8 and p.corruttori == 1: p.corruttorig8 = 1 if p.numberg == 8 and p.corruttori == 2: p.corruttorig8 = 2 if p.numberg == 8 and p.corruttori == 3: p.corruttorig8 = 3 def partecip(self): for p in self.get_players(): if p.numberg == 1 and p.partecipantipg == 0: p.partecipantipg1 = 0 if p.numberg == 1 and p.partecipantipg == 1: p.partecipantipg1 = 0 if p.numberg == 1 and p.partecipantipg >= 2 : p.partecipantipg1 = 100 for p in self.get_players(): if p.numberg == 2 and p.partecipantipg == 0: p.partecipantipg2 = 0 if p.numberg == 2 and p.partecipantipg == 1: p.partecipantipg2 = 0 if p.numberg == 2 and p.partecipantipg >= 2: p.partecipantipg2 = 100 for p in self.get_players(): if p.numberg == 3 and p.partecipantipg == 0: p.partecipantipg3 = 0 if p.numberg == 3 and p.partecipantipg == 1: p.partecipantipg3 = 0 if p.numberg == 3 and p.partecipantipg >= 2: p.partecipantipg3 = 100 for p in self.get_players(): if p.numberg == 4 and p.partecipantipg == 0: p.partecipantipg4 = 0 if p.numberg == 4 and p.partecipantipg == 1: p.partecipantipg4 = 0 if p.numberg == 4 and p.partecipantipg >= 2: p.partecipantipg4 = 100 for p in self.get_players(): if p.numberg == 5 and p.partecipantipg == 0: p.partecipantipg5 = 0 if p.numberg == 5 and p.partecipantipg == 1: p.partecipantipg5 = 0 if p.numberg == 5 and p.partecipantipg >= 2: p.partecipantipg5 = 100 for p in self.get_players(): if p.numberg == 6 and p.partecipantipg == 0: p.partecipantipg6 = 0 if p.numberg == 6 and p.partecipantipg == 1: p.partecipantipg6 = 0 if p.numberg == 6 and p.partecipantipg >= 2: p.partecipantipg6 = 100 for p in self.get_players(): if p.numberg == 7 and p.partecipantipg == 0: p.partecipantipg7 = 0 if p.numberg == 7 and p.partecipantipg == 1: p.partecipantipg7 = 0 if p.numberg == 7 and p.partecipantipg >= 2: p.partecipantipg7 = 100 for p in self.get_players(): if p.numberg == 8 and p.partecipantipg == 0: p.partecipantipg8 = 0 if p.numberg == 8 and p.partecipantipg == 1: p.partecipantipg8 = 0 if p.numberg == 8 and p.partecipantipg >= 2: p.partecipantipg8 = 100 def set_payoffCORRUPT(self): contributions = 0 partecipanti= 0 bribe= 0 for p in self.get_players(): if p.contribution == 99: pass elif p.contribution == None: pass elif p.contribution == 100: partecipanti = partecipanti + 1 contributions = contributions + 0 bribe = bribe + 2 elif p.contribution == 300: partecipanti = partecipanti + 1 contributions = contributions + 3 bribe = bribe + 1 else: partecipanti = partecipanti + 1 contributions = contributions + p.contribution #punizioni for p in self.get_players(): if partecipanti > 1: if p.contribution == 100: p.punizione = 0 elif p.contribution == 300: p.punizione = 0 elif p.contribution == 0: p.punizione = 11 elif p.contribution == 3: p.punizione = 7 else: p.punizione = 0 else: p.punizione = 0 if partecipanti > 0: self.total_contribution= contributions * 2 self.individual_share = self.total_contribution / partecipanti if partecipanti == 1: self.total_contribution = 0 self.individual_share = 0 if partecipanti == 0: self.total_contribution= 0 self.individual_share = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == 99: p.payoff = Constants.Endowment elif p.contribution == 100: p.payoff = Constants.Endowment + self.individual_share - 2 elif p.contribution == 300: p.payoff = Constants.Endowment + self.individual_share - 4 else: p.payoff = Constants.Endowment - p.contribution + self.individual_share - p.punizione else: p.payoff = Constants.Endowment corruzione = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == 100: corruzione = corruzione + 1 if p.contribution == 300: corruzione = corruzione + 1 else: corruzione = corruzione + 0 else: corruzione = corruzione + 0 p2 = self.get_player_by_id(2) p3 = self.get_player_by_id(3) p1 = self.get_player_by_id(1) p1.corruzione = corruzione p2.corruzione = corruzione p3.corruzione = corruzione p1.partecipantipg = partecipanti p2.partecipantipg = partecipanti p3.partecipantipg = partecipanti corruttori = 0 for p in self.get_players(): if partecipanti > 1: if p.contribution == None: pass if p.contribution == 100: corruttori = corruttori + 1 if p.contribution == 300: corruttori = corruttori + 1 if p.contribution == 3: corruttori = corruttori + 0 if p.contribution == 6: corruttori = corruttori + 0 if p.contribution == 9: corruttori = corruttori + 0 if p.contribution == 99: corruttori = corruttori + 0 else: corruttori = corruttori + 0 p1.corruttori = corruttori p2.corruttori = corruttori p3.corruttori = corruttori class Player(BasePlayer): QuestionPG = models.IntegerField(choices=[[18, '3 + 6 + 9 = 18 points'], [36, '3 + 6 + 9 = 18 points. 18 x 2 = 36 points']], label='1) What is the value of the common project?', widget=widgets.RadioSelect) Questionme = models.IntegerField(choices=[[24, '36 : 3 = 12 points. 14 + 12 = 24 points'], [20, '36 : 3 = 12 points. 14 - 6 + 12 = 20 points']], label="2) What is your payoff, if the umpire doesn't take you away any point?", widget=widgets.RadioSelect) contribution = models.IntegerField(choices=[[0, '0'], [100, '0 and 2 points to the umpire'], [3, '3'], [300, '3 and 1 point to the umpire'], [6, '6'], [9, '9'], [99, 'Exit']], label='How much do you want to put in the common project?', widget=widgets.RadioSelect) mazzetta = models.IntegerField() Info = models.BooleanField(choices=[[True, 'Yes'], [False, 'No']], label="Do you want to buy information about the previous round umpire's decisions, paying 1 point?", widget=widgets.RadioSelect) infostringa = models.StringField() valoremazzetta = models.IntegerField() punizione = models.IntegerField(choices=[[0, '0'], [7, '7'], [11, '11']]) numberg = models.IntegerField() progettocomune = models.StringField() progettocomunepl2 = models.StringField() progettocomunepl3 = models.StringField() progettocomunepl1 = models.StringField() corruzione = models.IntegerField() corruttori = models.IntegerField() umpirelastgroup = models.IntegerField() umpire = models.IntegerField() value = models.IntegerField() corruttoriprima = models.StringField() corruzioneprima = models.StringField() randomgroup = models.IntegerField() contributionplayer2 = models.IntegerField() contributionplayer3 = models.IntegerField() contributionplayer1 = models.IntegerField() numberpl = models.IntegerField() partecipantiprima = models.IntegerField() partecipantipg = models.IntegerField() partecipantipg1 = models.IntegerField() partecipantipg2 = models.StringField() partecipantipg3 = models.StringField() partecipantipg4 = models.StringField() partecipantipg5 = models.StringField() partecipantipg6 = models.StringField() partecipantipg7 = models.StringField() partecipantipg8 = models.StringField() corruzg1 = models.IntegerField() corruzg2 = models.IntegerField() corruzg3 = models.IntegerField() corruzg4 = models.IntegerField() corruzg5 = models.IntegerField() corruzg6 = models.IntegerField() corruzg7 = models.IntegerField() corruzg8 = models.IntegerField() corruttorig1 = models.IntegerField() corruttorig2 = models.IntegerField() corruttorig3 = models.IntegerField() corruttorig4 = models.IntegerField() corruttorig5 = models.IntegerField() corruttorig6 = models.IntegerField() corruttorig7 = models.IntegerField() corruttorig8 = models.IntegerField() gruppo1pl1 = models.StringField() gruppo1pl2 = models.StringField() gruppo1pl3 = models.StringField() gruppo2pl3 = models.StringField() gruppo2pl2 = models.StringField() gruppo2pl1 = models.StringField() gruppo3pl3 = models.StringField() gruppo3pl2 = models.StringField() gruppo3pl1 = models.StringField() gruppo4pl3 = models.StringField() gruppo4pl2 = models.StringField() gruppo4pl1 = models.StringField() gruppo5pl3 = models.StringField() gruppo5pl2 = models.StringField() gruppo5pl1 = models.StringField() gruppo6pl3 = models.StringField() gruppo6pl1 = models.StringField() gruppo6pl2 = models.StringField() gruppo7pl3 = models.StringField() gruppo7pl2 = models.StringField() gruppo7pl1 = models.StringField() gruppo8pl2 = models.StringField() gruppo8pl3 = models.StringField() gruppo8pl1 = models.StringField() punizgruppo1pl3 = models.StringField() punizgruppo1pl2 = models.StringField() punizgruppo1pl1 = models.StringField() punizgruppo2pl3 = models.StringField() punizgruppo2pl2 = models.StringField() punizgruppo2pl1 = models.StringField() punizgruppo3pl3 = models.StringField() punizgruppo3pl2 = models.StringField() punizgruppo3pl1 = models.StringField() punizgruppo4pl3 = models.StringField() punizgruppo4pl2 = models.StringField() punizgruppo4pl1 = models.StringField() punizgruppo5pl3 = models.StringField() punizgruppo5pl2 = models.StringField() punizgruppo5pl1 = models.StringField() punizgruppo6pl3 = models.StringField() punizgruppo6pl2 = models.StringField() punizgruppo6pl1 = models.StringField() punizgruppo7pl3 = models.StringField() punizgruppo7pl2 = models.StringField() punizgruppo7pl1 = models.StringField() punizgruppo8pl3 = models.StringField() punizgruppo8pl2 = models.StringField() punizgruppo8pl1 = models.StringField() partecipanti = models.IntegerField() def setglobals(self): self.participant.vars['HonestR_payoff'] = self.participant.payoff return(self.participant.vars)