from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import csv import numpy doc = """ INTRO: Welcome and introductions to the experimental setting. """ class Constants(BaseConstants): name_in_url = 'code_intro' players_per_group = 2 players_per_supergroup = 4 num_rounds = 1 show_up_fee = "4" other_players_in_group = 3 class Subsession(BaseSubsession): show_up_fee = models.IntegerField() def creating_session(self): self.show_up_fee = self.session.config['show_up_fee'] for p in self.get_players(): p.conversion_rate = self.session.config['points100_value_eur'] # Payoff from mutual cooperation (Reward Payoff) p.payoff_R = self.session.config['payoff_R'] # Payoff from mutual cooperation (Punishment Payoff) p.payoff_P = self.session.config['payoff_P'] # Payoff from unilateral cooperation (Sucker Payoff) p.payoff_S = self.session.config['payoff_S'] # Payoff from unilateral defection (Temptation Payoff) p.payoff_T = self.session.config['payoff_T'] p.show_up_fee = self.session.config['show_up_fee'] class Group(BaseGroup): pass class Player(BasePlayer): show_up_fee = models.IntegerField() conversion_rate = models.StringField() payoff_R = models.IntegerField() payoff_P = models.IntegerField() payoff_S = models.IntegerField() payoff_T = models.IntegerField()