from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'BG_EXIT' PLAYERS_PER_GROUP = 5 NUM_ROUNDS = 5 INFOCOST = 3 ENDOWMENT = cu(14) MULTIPLIER = 2 INSTRUCTIONSUMPIRE_TEMPLATE = 'BG_EXIT/instructionsumpire.html' INSTRUCTIONSPLAYER_TEMPLATE = 'BG_EXIT/instructionsplayer.html' INSTRUCTIONSGENERIC_TEMPLATE = 'BG_EXIT/instructionsgeneric.html' class Subsession(BaseSubsession): corruzione = models.IntegerField() corruzionesessione = models.IntegerField() robotcorrupt = models.IntegerField() corruzionegruppi = models.IntegerField() corruzioneround = models.IntegerField() corruzioneg1 = models.IntegerField(initial=0) corruzioneg2 = models.IntegerField(initial=0) corruzioneg3 = models.IntegerField(initial=0) corruzioneg4 = models.IntegerField(initial=0) tuttacorruzione = models.IntegerField() def creating_session(subsession: Subsession): session = subsession.session subsession.group_randomly(fixed_id_in_group=True) def my_function2(subsession: Subsession): session = subsession.session for g in subsession.get_groups(): if g.id_in_subsession == 1: subsession.corruzioneg1 = g.corruzioneround if g.id_in_subsession == 2: subsession.corruzioneg2 = g.corruzioneround if g.id_in_subsession == 3: subsession.corruzioneg3 = g.corruzioneround if g.id_in_subsession == 4: subsession.corruzioneg4 = g.corruzioneround subsession.corruzionesessione = subsession.corruzioneg1 + subsession.corruzioneg2 + subsession.corruzioneg3 + subsession.corruzioneg4 subsession.tuttacorruzione = sum([p.corruzionesessione for p in subsession.in_all_rounds()]) Subsession.creating_session = creating_session Subsession.my_function2 = my_function2 class Group(BaseGroup): contributions = models.IntegerField() partecipanti = models.IntegerField() umpirelastgroup = models.IntegerField() total_contribution = models.CurrencyField() individual_share = models.CurrencyField() corruzioneround = models.IntegerField() total_corruzione = models.IntegerField() total = models.IntegerField() corruzione = models.IntegerField() def after_all_players_arrive(group: Group): session = group.session subsession = group.subsession #creazione delle stringhe p1 = group.get_player_by_id(1) p2 = group.get_player_by_id(2) p3 = group.get_player_by_id(3) p4 = group.get_player_by_id(4) p5 = group.get_player_by_id(5) for p in group.get_players(): p.exit0 = 0 if p2.contribution == 99: p2.exit0 = p.exit0 + 1 if p3.contribution == 99: p3.exit0 = p.exit0 + 1 if p4.contribution == 99: p4.exit0 = p.exit0 + 1 if p5.contribution == 99: p5.exit0 = p.exit0 + 1 else: p.exit0 = p.exit0 p.exitpl2 = 0 if p2.exit0 == 1: p1.exitpl2 = p.exitpl2 + 1 p2.exitpl2 = p.exitpl2 + 1 p3.exitpl2 = p.exitpl2 + 1 p4.exitpl2 = p.exitpl2 + 1 p5.exitpl2 = p.exitpl2 + 1 if p2.exit0 == 0: p.exitpl2 = p.exitpl2 + 0 p.exitpl3 = 0 if p3.exit0 == 1: p1.exitpl3 = p.exitpl3 + 1 p2.exitpl3 = p.exitpl3 + 1 p3.exitpl3 = p.exitpl3 + 1 p4.exitpl3 = p.exitpl3 + 1 p5.exitpl3 = p.exitpl3 + 1 if p3.exit0 == 0: p.exitpl3 = p.exitpl3 + 0 p.exitpl4 = 0 if p4.exit0 == 1: p1.exitpl4 = p.exitpl4 + 1 p2.exitpl4 = p.exitpl4 + 1 p3.exitpl4 = p.exitpl4 + 1 p4.exitpl4 = p.exitpl4 + 1 p5.exitpl4 = p.exitpl4 + 1 if p4.exit0 == 0: p.exitpl4 = p.exitpl4 + 0 p.exitpl5 = 0 if p5.exit0 == 1: p1.exitpl5 = p.exitpl5 + 1 p2.exitpl5 = p.exitpl5 + 1 p3.exitpl5 = p.exitpl5 + 1 p4.exitpl5 = p.exitpl5 + 1 p5.exitpl5 = p.exitpl5 + 1 if p5.exit0 == 0: p.exitpl5 = p.exitpl5 + 0 # stinghe x pagine punishment arbitro/accettaz bribe try: p.bribeplayer2 = 0 p1.bribeplayer2 = p2.bribe except TypeError: p2.bribe = None try: p.bribeplayer3 = 0 p1.bribeplayer3 = p3.bribe except TypeError: p3.bribe = None try: p.bribeplayer4 = 0 p1.bribeplayer4 = p4.bribe except TypeError: p4.bribe = None try: p.bribeplayer5 = 0 p1.bribeplayer5 = p5.bribe except TypeError: p5.bribe = None for p in group.get_players(): try: if group.round_number == 1: p2.progettocomune = p2.contribution elif group.round_number != 1 and p.partecipare != 0: p2.progettocomune = p2.contribution else: p2.progettocomune = 99 except TypeError: p2.contribution = None try: if group.round_number == 1: p3.progettocomune = p3.contribution elif group.round_number != 1 and p.partecipare != 0: p3.progettocomune = p3.contribution else: p3.progettocomune = 99 except TypeError: p3.contribution = None try: if group.round_number == 1: p4.progettocomune = p4.contribution elif group.round_number != 1 and p.partecipare != 0: p4.progettocomune = p4.contribution else: p4.progettocomune = 99 except TypeError: p4.contribution = None try: if group.round_number == 1: p5.progettocomune = p5.contribution elif group.round_number != 1 and p.partecipare != 0: p5.progettocomune = p5.contribution else: p5.progettocomune = 99 except TypeError: p5.contribution = None #stringhe x feedback da mostrare al player 2 (non faccio vedere le bribe) # if p3.progettocomune == "Uscita": try: p2.progettocomunepl3 = p3.progettocomune p1.progettocomunepl3 = p3.progettocomune p4.progettocomunepl3 = p3.progettocomune p5.progettocomunepl3 = p3.progettocomune except TypeError: p3.progettocomune = None try: p2.progettocomunepl4 = p4.progettocomune p1.progettocomunepl4 = p4.progettocomune p3.progettocomunepl4 = p4.progettocomune p5.progettocomunepl4 = p4.progettocomune except TypeError: p4.progettocomune = None try: p2.progettocomunepl5 = p5.progettocomune p1.progettocomunepl5 = p5.progettocomune p3.progettocomunepl5 = p5.progettocomune p4.progettocomunepl5 = p5.progettocomune except TypeError: p5.progettocomune = None try: p5.progettocomunepl2 = p2.progettocomune p1.progettocomunepl2 = p2.progettocomune p3.progettocomunepl2 = p2.progettocomune p4.progettocomunepl2 = p2.progettocomune except TypeError: p2.progettocomune = None #group number for p in group.get_players(): if group.id_in_subsession == 1: p1.numberg = 1 p2.numberg = 1 p3.numberg = 1 p4.numberg = 1 p5.numberg = 1 elif group.id_in_subsession == 2: p1.numberg = 2 p2.numberg = 2 p3.numberg = 2 p4.numberg = 2 p5.numberg = 2 elif group.id_in_subsession == 3: p1.numberg = 3 p2.numberg = 3 p3.numberg = 3 p4.numberg = 3 p5.numberg = 3 elif group.id_in_subsession == 4: p1.numberg = 4 p2.numberg = 4 p3.numberg = 4 p4.numberg = 4 p5.numberg = 4 partecipanti = 0 for p in group.get_players(): try: if p.contribution == 99 or p.contribution == 700: pass else: partecipanti = partecipanti + 1 except TypeError: p.contribution = None p.partecipantipg = partecipanti p1.partecipantipg = p5.partecipantipg p2.partecipantipg = p5.partecipantipg p3.partecipantipg = p5.partecipantipg p4.partecipantipg = p5.partecipantipg # - 1 because it countes the umpire #p1.partecipantipg = partecipanti #p2.partecipantipg = partecipanti #p3.partecipantipg = partecipanti #p4.partecipantipg = partecipanti #p5.partecipantipg = partecipanti def set_payoff1(group: Group): contributions = 0 partecipanti = 0 bribe = 0 #for p in group.get_players(): # try: # if p.contribution == 99: # pass # else: # partecipanti = partecipanti + 1 # except TypeError: # p.contribution = None for p in group.get_players(): try: if p.contribution == 99: pass else: contributions = contributions + p.contribution bribe = bribe + p.bribe except TypeError: p.contribution = None p.bribe = None for p in group.get_players(): if partecipanti > 1: group.total_contribution= contributions * 2 group.individual_share = group.total_contribution / partecipanti elif partecipanti == 1: group.total_contribution = 0 group.individual_share = 0 else: group.total_contribution= 0 group.individual_share = 0 #modifica variabile punizione ai fini del calcolo payoff (la variabile punishment è al livllo del player, ma l'arbitro punisce con ogni variabile un solo giocatore: devo perciò "cancellare" i casi vuoti for p in group.get_players(): p1 = group.get_player_by_id(1) p2 = group.get_player_by_id(2) p3 = group.get_player_by_id(3) p4 = group.get_player_by_id(4) p5 = group.get_player_by_id(5) p1.mazzetta = bribe p.punizione2 = 0 if p1.punishment2 == 700: p1.punizione2 = 0 else: p.punizione2 = p.punizione2 + p1.punishment2 p.punizione3 = 0 if p1.punishment3 == 700: p1.punizione3 = 0 #pass else: p.punizione3 = p.punizione3 + p1.punishment3 p.punizione4 = 0 if p1.punishment4 == 700: p1.punizione4 = 0 # pass else: p.punizione4 = p.punizione4 + p1.punishment4 p.punizione5 = 0 if p1.punishment5 == 700: p1.punizione5 = 0 # pass else: p.punizione5 = p.punizione5 + p1.punishment5 p1.punizione2 = p5.punizione2 p1.punizione3 = p5.punizione3 p1.punizione4 = p5.punizione4 p1.punizione5 = p5.punizione5 p.punizione = 0 if p1.punishment2 == 700: p2.punizione = 0 else: p2.punizione = p.punizione2 if p1.punishment3 == 700: p3.punizione = 0 else: p3.punizione = p.punizione + p.punizione3 if p1.punishment4 == 700: p4.punizione = 0 else: p4.punizione = p.punizione + p.punizione4 if p1.punishment5 == 700: p5.punizione = 0 else: p5.punizione = p.punizione + p.punizione5 if p.punishment2 == 700: p1.punishment2 = 0 if p.punishment3 == 700: p1.punishment3 = 0 if p.punishment4 == 700: p1.punishment4 = 0 if p.punishment5 == 700: p1.punishment5 = 0 #payoff participants for p in group.get_players(): if partecipanti > 1: if p2.contribution == 99: p2.payoff = C.ENDOWMENT else: p2.payoff = C.ENDOWMENT - p2.contribution + group.individual_share - p2.bribe - p2.punizione else: p2.payoff = C.ENDOWMENT for p in group.get_players(): if partecipanti > 1: if p3.contribution == 99: p3.payoff = C.ENDOWMENT else: p3.payoff = C.ENDOWMENT - p3.contribution + group.individual_share - p3.bribe - p3.punizione else: p3.payoff = C.ENDOWMENT for p in group.get_players(): if partecipanti > 1: if p4.contribution == 99: p4.payoff = C.ENDOWMENT else: p4.payoff = C.ENDOWMENT - p4.contribution - p4.bribe + group.individual_share - p4.punizione else: p4.payoff = C.ENDOWMENT for p in group.get_players(): if partecipanti > 1: if p5.contribution == 99: p5.payoff = C.ENDOWMENT else: p5.payoff = C.ENDOWMENT - p5.contribution - p5.bribe + group.individual_share - p5.punizione else: p5.payoff = C.ENDOWMENT corruzione = 0 if partecipanti > 1: if p1.bribe2 > 0: corruzione = corruzione + 1 else: corruzione = corruzione + 0 if p1.bribe3 > 0: corruzione = corruzione + 1 else: corruzione = corruzione + 0 if p1.bribe4 > 0: corruzione = corruzione + 1 else: corruzione = corruzione + 0 if p1.bribe5 > 0: corruzione = corruzione + 1 else: corruzione = corruzione + 0 else: corruzione = corruzione + 0 p1.corruzione = corruzione p2.corruzione = corruzione p3.corruzione = corruzione p4.corruzione = corruzione p5.corruzione = corruzione #corruzioneround = corruzione nei gruppo corruzioneround = 0 if corruzione > 0: corruzioneround = 1 + corruzioneround else: corruzioneround = 0 + corruzioneround group.corruzioneround = corruzioneround if p1.bribe2 == 1: p.bribepl2 = p1.bribeplayer2 else: p.bribepl2 = 0 if p1.bribe3 == 1: p.bribepl3 = p1.bribeplayer3 else: p.bribepl3 = 0 if p1.bribe4 == 1: p.bribepl4 = p1.bribeplayer4 else: p.bribepl4 = 0 if p1.bribe5 == 1: p.bribepl5 = p1.bribeplayer5 else: p.bribepl5 = 0 p1.bribepl2 = p5.bribepl2 p1.bribepl3 = p5.bribepl3 p1.bribepl4 = p5.bribepl4 p1.bribepl5 = p5.bribepl5 #if p1.bribe2 == 1: # p1.bribepl2 = p1.bribeplayer2 #if p1.bribe3 == 1: # p1.bribepl3 = p1.bribeplayer3 #if p1.bribe4 == 1: # p1.bribepl4 = p1.bribeplayer4 #if p1.bribe5 == 1: # p1.bribepl5 = p1.bribeplayer5 p.valoremazzetta = p1.bribepl2 + p1.bribepl3 + p1.bribepl4 + p1.bribepl5 p1.valoremazzetta = p5.valoremazzetta corruttori = 0 for p in group.get_players(): if partecipanti > 1: try: if p.bribe > 0: corruttori = corruttori + 1 else: corruttori = corruttori + 0 except TypeError: p.bribe = None p1.corruttori = corruttori p2.corruttori = corruttori p3.corruttori = corruttori p4.corruttori = corruttori p5.corruttori = corruttori #payoff arbitro if partecipanti > 1: if group.total_contribution >= 54: p1.payoff = 17 + 8 + p.valoremazzetta p1.bonus = 8 else: p1.payoff = 17 + p.valoremazzetta p1.bonus = 0 else: p1.payoff = 17 p1.bonus = 0 def verify(group: Group): for p in group.get_players(): try: if p.contribution == 99: p.sommacontribbribe = 0 else: p.sommacontribbribe = p.contribution + p.bribe except TypeError: p.contribution = None try: if p.sommacontribbribe > 10: p.errore = 1 else: p.errore = 0 except TypeError: p.contribution = None Group.after_all_players_arrive = after_all_players_arrive Group.set_payoff1 = set_payoff1 class Player(BasePlayer): QuestionPG = models.IntegerField(choices=[[27, '9 (contribuzione) + 9 (contribuzione) + 9 (contribuzione) + 0 (contribuzione) = 27 punti.'], [54, '9 (contribuzione) + 9 (contribuzione) + 9 (contribuzione) + 0 (contribuzione) = 27 punti. 27 x 2 (moltiplicatore progetto comune) = 54 punti']], label='1) Quanto vale il progetto comune?', widget=widgets.RadioSelect) Questionme = models.IntegerField(choices=[[19, '54 : 4 (partecipanti) = 14 punti (quota individuale progetto comune). 14 (dotazione iniziale) - 9 (contribuzione) + 14 = 19 punti'], [28, '54 : 4 (partecipanti) = 14 punti (quota individuale progetto comune). 14 (dotazione iniziale) + 14 = 28 punti']], label="2) Quanti punti ottieni complessivamente, se l'arbitro non ti toglie nessun punto?", widget=widgets.RadioSelect) Question3 = models.IntegerField(choices=[[16, "14 + 12 (quota individuale progetto comune) - 3 (contribuzione) - 7 (punti tolti dall'arbitro) = 16 punti"], [19, "14 + 12 (quota individuale progetto comune) - 7 (punti tolti dall'arbitro) = 19 punti"]], label="3) Quanti punti ottiene complessivamente il partecipante che ha messo 3 punti nel progetto comune, se l'arbitro gli ha tolto 7 punti?", widget=widgets.RadioSelect) QuestionUmp = models.IntegerField(choices=[[17, '17 punti'], [25, '17 + 8 (punti ottenuti grazie al progetto comune) = 25 punti se non accetti i punti offerti '], [27, '17 + 8 (punti ottenuti grazie al progetto comune) + 2 (punti offerti) = 27 punti se accetti i punti offerti']], label='2) Quanti punti ottieni complessivamente?', widget=widgets.RadioSelect) mazzetta = models.IntegerField() bonus = models.IntegerField() punishment2 = models.IntegerField(choices=[[0, 'Nessun punto'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], [11, '11'], [12, '12'], [13, '13'], [14, '14'], [15, '15']], initial=700, label='Indica se e quanti punti vuoi togliere al partecipante') punishment3 = models.IntegerField(choices=[[0, 'Nessun punto'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], [11, '11'], [12, '12'], [13, '13'], [14, '14'], [15, '15']], initial=700, label='Indica se e quanti punti vuoi togliere al partecipante') punishment4 = models.IntegerField(choices=[[0, 'Nessun punto'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], [11, '11'], [12, '12'], [13, '13'], [14, '14'], [15, '15']], initial=700, label='Indica se e quanti punti vuoi togliere al partecipante') punishment5 = models.IntegerField(choices=[[0, 'Nessun punto'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], [11, '11'], [12, '12'], [13, '13'], [14, '14'], [15, '15']], initial=700, label='Indica se e quanti punti vuoi togliere al partecipante') bribe2 = models.IntegerField(choices=[[1, 'Si'], [0, 'No']], initial=700, label='Vuoi accettare i punti che ti ha offerto il partecipante?', widget=widgets.RadioSelectHorizontal) bribe3 = models.IntegerField(choices=[[1, 'Si'], [0, 'No']], initial=700, label='Vuoi accettare i punti che ti ha offerto il partecipante?', widget=widgets.RadioSelectHorizontal) bribe4 = models.IntegerField(choices=[[1, 'Si'], [0, 'No']], initial=700, label='Vuoi accettare i punti che ti ha offerto il partecipante?', widget=widgets.RadioSelectHorizontal) bribe5 = models.IntegerField(choices=[[1, 'Si'], [0, 'No']], initial=700, label='Vuoi accettare i punti che ti ha offerto il partecipante?', widget=widgets.RadioSelectHorizontal) bribepl2 = models.IntegerField(choices=[], initial=0) bribepl3 = models.IntegerField(initial=0) bribepl4 = models.IntegerField(initial=0) bribepl5 = models.IntegerField(initial=0) Infonew = models.IntegerField(choices=[[1, 'Si'], [0, 'No']], initial=700, label="Vuoi comprare un'informazione sulle decisioni prese dall'arbitro nel round precedente, al costo di 3 punti?", widget=widgets.RadioSelect) Info = models.BooleanField(choices=[[True, 'Si'], [False, 'No']], label="Vuoi comprare un'informazione sulle decisioni prese dall'arbitro nel round precedente, al costo di 3 punti?", widget=widgets.RadioSelect) infostringa = models.StringField(initial='-') punizione2 = models.IntegerField(choices=[]) punizione3 = models.IntegerField(choices=[]) punizione4 = models.IntegerField(choices=[]) punizione5 = models.IntegerField(choices=[]) valoremazzetta = models.IntegerField() punizione = models.IntegerField() numberg = models.IntegerField(choices=[[1, '1'], [2, '2'], [3, '3']]) exit0 = models.IntegerField(initial=0) exitpl2 = models.IntegerField(initial=0) exitpl3 = models.IntegerField(initial=0) exitpl4 = models.IntegerField(initial=0) exitpl5 = models.IntegerField() progettocomune = models.IntegerField() infopunizione = models.IntegerField(choices=[[0, '0'], [7, '7'], [11, '11']]) infocontribution = models.IntegerField(choices=[[0, '0'], [3, '3'], [100, '100'], [300, '300'], [6, '6'], [9, '9'], [99, '99']]) my_field2 = models.IntegerField() corruzione = models.IntegerField() corruttori = models.IntegerField() umpirelastgroup = models.IntegerField() corruttoriprima = models.StringField() corruzioneprima = models.StringField() bribeplayer2 = models.IntegerField() bribeplayer3 = models.IntegerField() bribeplayer4 = models.IntegerField() bribeplayer5 = models.IntegerField() partecipantiprima = models.IntegerField() partecipantipg1 = models.IntegerField() partecipantipg2 = models.IntegerField() partecipantipg3 = models.IntegerField() partecipantipg4 = models.IntegerField() partecipantipg5 = models.IntegerField() partecipantipg = models.IntegerField() partecipare = models.IntegerField(choices=[[1, 'Partecipo'], [0, 'Esco']], initial=700, label='Vuoi partecipare al progetto comune o vuoi uscire dal gioco?', widget=widgets.RadioSelect) contribution = models.IntegerField(choices=[[0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10'], [99, 'Esco']], initial=700, label='Quanto vuoi mettere nel progetto comune?') bribe = models.IntegerField(blank=True, choices=[[0, 'Nessun punto'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], [8, '8'], [9, '9'], [10, '10']], label="Vuoi offrire dei punti all'aribtro? Quanti?") errore = models.BooleanField(initial=False) sommacontribbribe = models.IntegerField(initial=0) progettocomunepl2 = models.IntegerField() progettocomunepl3 = models.IntegerField() progettocomunepl4 = models.IntegerField() progettocomunepl5 = models.IntegerField() def setglobals(player: Player): session = player.session subsession = player.subsession participant = player.participant participant.vars['Human_umpire_payoff'] = participant.payoff #session.vars['corruzionetot'] = subsession.tuttacorruzione return(participant.vars) Player.setglobals = setglobals class Attesagruppixpartire(WaitPage): wait_for_all_groups = True @staticmethod def is_displayed(player: Player): return player.round_number == 1 class Role(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.round_number == 1 class IstruzioniPlayer(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.round_number == 1 and player.id_in_group != 1 class IstruzioniUmpire(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.round_number == 1 and player.id_in_group == 1 class Start(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.round_number == 1 class Contribuzione(Page): form_model = 'player' form_fields = ['contribution', 'bribe'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group != 1 class CheckingForErrors(WaitPage): after_all_players_arrive = verify @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group != 1 and player.sommacontribbribe > 14 class Error(Page): form_model = 'player' form_fields = ['contribution', 'bribe'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group != 1 and player.errore == 1 class Giocatori(WaitPage): after_all_players_arrive = after_all_players_arrive @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group != 1 class WaitingUmpire(WaitPage): body_text = 'Attendi che i partecipanti facciano le loro scelte' @staticmethod def is_displayed(player: Player): group = player.group return group.get_player_by_id(1) class Punishment2(Page): form_model = 'player' form_fields = ['punishment2'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl2 == 0 and player.bribeplayer2 == 0 and player.partecipantipg >1 class Punishment2bribe(Page): form_model = 'player' form_fields = ['bribe2', 'punishment2'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl2 == 0 and player.bribeplayer2 != 0 and player.partecipantipg >1 class Nopunishment2(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl2 == 1 and player.partecipantipg > 1 class NoPunishment2NOPGExit(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl2 == 1 and player.partecipantipg <= 1 class NoPunishment2NOPG(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl2 == 0 and player.partecipantipg <= 1 class Punishment3(Page): form_model = 'player' form_fields = ['punishment3'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl3 == 0 and player.bribeplayer3 == 0 and player.partecipantipg >1 class Punishment3bribe(Page): form_model = 'player' form_fields = ['bribe3', 'punishment3'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl3 == 0 and player.bribeplayer3 !=0 and player.partecipantipg >1 class Nopunishment3(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl3 == 1 and player.partecipantipg > 1 class NoPunishment3NOPGEXIT(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl3 == 1 and player.partecipantipg <= 1 class NoPunishment3NOPG(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl3== 0 and player.partecipantipg <= 1 class Punishment4(Page): form_model = 'player' form_fields = ['punishment4'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl4 == 0 and player.bribeplayer4 == 0 and player.partecipantipg > 1 class Punishment4bribe(Page): form_model = 'player' form_fields = ['bribe4', 'punishment4'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl4 == 0 and player.bribeplayer4 != 0 and player.partecipantipg >1 class Nopunishment4(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl4 == 1 and player.partecipantipg > 1 class NoPunishment4NOPG(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl4 == 0 and player.partecipantipg <= 1 class NoPunishment4NOPGEXIT(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl4 == 1 and player.partecipantipg <= 1 class Punishment5(Page): form_model = 'player' form_fields = ['punishment5'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl5 == 0 and player.bribeplayer5 == 0 and player.partecipantipg >1 class Punishment5bribe(Page): form_model = 'player' form_fields = ['bribe5', 'punishment5'] @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl5 == 0 and player.bribeplayer5 !=0 and player.partecipantipg >1 class Nopunishment5(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl5 == 1 and player.partecipantipg > 1 class NoPunishment5NOPG(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl5 == 0 and player.partecipantipg <= 1 class NoPunishment5NOPGEXIT(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group == 1 and player.exitpl5 == 1 and player.partecipantipg <= 1 class Attesagiocatori(WaitPage): after_all_players_arrive = after_all_players_arrive @staticmethod def is_displayed(player: Player): group = player.group return player.id_in_group != 1 class ExecutingPayoffRound1(WaitPage): after_all_players_arrive = set_payoff1 class PayoffRound1(Page): form_model = 'player' @staticmethod def before_next_page(player: Player, timeout_happened): player.setglobals() class Ringraziamento(Page): form_model = 'player' @staticmethod def is_displayed(player: Player): return player.round_number == 5 page_sequence = [Attesagruppixpartire, Role, IstruzioniPlayer, IstruzioniUmpire, Start, Contribuzione, CheckingForErrors, Error, Giocatori, WaitingUmpire, Punishment2, Punishment2bribe, Nopunishment2, NoPunishment2NOPGExit, NoPunishment2NOPG, Punishment3, Punishment3bribe, Nopunishment3, NoPunishment3NOPGEXIT, NoPunishment3NOPG, Punishment4, Punishment4bribe, Nopunishment4, NoPunishment4NOPG, NoPunishment4NOPGEXIT, Punishment5, Punishment5bribe, Nopunishment5, NoPunishment5NOPG, NoPunishment5NOPGEXIT, Attesagiocatori, ExecutingPayoffRound1, PayoffRound1, Ringraziamento]