from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import csv import numpy doc = """ Part 2 (c) Instructions and Control questions before the series of "Infinitely Repeated Prisoner's Dilemma" begins. """ class Constants(BaseConstants): name_in_url = 'part2_c_I' players_per_group = 2 players_per_supergroup = 4 num_rounds = 1 other_players_in_group = 3 # rematch_prob = '33%' # payoff if 1 player defects and the other cooperates""", betray_payoff = c(100) betrayed_payoff = c(10) # payoff if both players cooperate or both defect both_cooperate_payoff = c(73) both_defect_payoff = c(43) class Subsession(BaseSubsession): def before_session_starts(self): for p in self.get_players(): p.continuation_prob = self.session.config['continuation_prob'] p.delta_limit = self.session.config['delta_limit'] class Group(BaseGroup): pass class Player(BasePlayer): continuation_prob = models.CharField() delta_limit = models.IntegerField() cq2_group_members = models.IntegerField( label="(a) Prima che il primo round abbia inizio verranno formati i gruppi. Quanti partecipanti\ ci saranno in ogni gruppo? ") cq2_match_termination = models.IntegerField( label="(b) La durata di ciascun match è:", choices=[[1, 'Pre-determinata'], [2, 'Determinata casualmente']] ) cq2_cont_prob = models.IntegerField( label="(c) Dopo ciascun round, qual è la probabilità che il match continui per un altro round?", min=0, max=100) cq2_within_matching = models.IntegerField( label="(d) Se un match dura per più di un round, giocherai con lo stesso partner per l’intero match?", choices=[[1, 'Si'], [2, 'No']]) cq2_payoff_match_bothcoop = models.IntegerField( label="(e) Qual è il tuo guadagno complessivo dal match n.3 - in punti - se il match n.3 dura due round e sia\ tu che la tua controparte avete scelto X in entrambi i round?") cq2_payoff_match_bothdef = models.IntegerField( label="(f) Qual è il tuo guadagno complessivo dal match n.4 - in punti - se il match n.4 dura due round e sia\ tu che la tua controparte avete scelto Y in entrambi i round?") cq2_payoff_match_sucker = models.IntegerField( label="(g) Chi sta meglio alla fine del match n.1 se il match n.1 dura due round e in entrambi i round tu\ hai scelto X e la tua controparte Y?", choices=[[1, "Io"], [2, "L'altro partecipante"]] )