from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import csv import numpy doc = """ This is a one-shot "Prisoner's Dilemma". Two players are asked separately whether they want to cooperate or defect. Their choices directly determine the payoffs. """ class Constants(BaseConstants): name_in_url = 'strategic_draft1a' players_per_group = 2 players_per_supergroup = 4 num_rounds = 1 show_up_fee = "4 Euros" other_players_in_group = 3 # 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): pass class Group(BaseGroup): pass class Player(BasePlayer): cq1_group_members = models.IntegerField( label="(a) Before you start playing groups will be formed. How many people will be in each group?") cq1_payoff_sucker = models.IntegerField( label="(b) What is your payoff if you choose X and your partner chooses Y?", min=0, max=100) cq1_payoff_bothcoop = models.IntegerField( label="(c) What is your payoff if you choose X and your partner chooses X?", min=0, max=100) cq1_aggr_bothcoop = models.IntegerField( label="(d) What is the aggregate payoff (sum yours and your partner’s payoffs) if you both choose X?") cq1_aggr_bothdef = models.IntegerField( label="(e) What is the aggregate payoff (sum yours and your partner’s payoffs) if you both choose Y?") cq1_highest_payoff = models.IntegerField( label="(f) What is the situation in which the aggregate payoff is the highest?", choices=[[1, 'You: X; Other: X'], [2, 'You: X; Other: Y'], [3, 'You: Y; Other: X'], [4, 'You: Y; Other: Y']], widget=widgets.RadioSelect, )