from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random author = 'Maxim Ott' doc = """ Shows all the results to the participants. Only uses session.vars and participant.vars """ class Constants(BaseConstants): name_in_url = 'SI_exp_10_12_results' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def vars_for_admin_report(self): # This works because EVERYONE is in the same group here # For every experiment pick two players: exp10_paying_players = random.sample(self.get_players(),2) exp11_paying_players = random.sample(self.get_players(),2) exp12_paying_players = random.sample(self.get_players(),2) return { 'paying_player_1_exp10': [ exp10_paying_players[0].participant.label, exp10_paying_players[0].participant.vars['exp10_my_role'], exp10_paying_players[0].participant.vars['exp10_my_choice'], exp10_paying_players[0].participant.vars['exp10_my_payoff'], exp10_paying_players[0].participant.vars['exp10_others_role'], exp10_paying_players[0].participant.vars['exp10_others_choice'], exp10_paying_players[0].participant.vars['exp10_others_payoff'], ], 'paying_player_2_exp10': [ exp10_paying_players[1].participant.label, exp10_paying_players[1].participant.vars['exp10_my_role'], exp10_paying_players[1].participant.vars['exp10_my_choice'], exp10_paying_players[1].participant.vars['exp10_my_payoff'], exp10_paying_players[1].participant.vars['exp10_others_role'], exp10_paying_players[1].participant.vars['exp10_others_choice'], exp10_paying_players[1].participant.vars['exp10_others_payoff'], ], 'paying_player_1_exp11': [ exp11_paying_players[0].participant.label, exp11_paying_players[0].participant.vars['exp11_my_choice'], exp11_paying_players[0].participant.vars['exp11_my_payoff'], exp11_paying_players[0].participant.vars['exp11_others_choice'], exp11_paying_players[0].participant.vars['exp11_others_payoff'], ], 'paying_player_2_exp11': [ exp11_paying_players[1].participant.label, exp11_paying_players[1].participant.vars['exp11_my_choice'], exp11_paying_players[1].participant.vars['exp11_my_payoff'], exp11_paying_players[1].participant.vars['exp11_others_choice'], exp11_paying_players[1].participant.vars['exp11_others_payoff'], ], 'paying_player_1_exp12': [ exp12_paying_players[0].participant.label, exp12_paying_players[0].participant.vars['exp12_my_choice'], exp12_paying_players[0].participant.vars['exp12_my_payoff'], exp12_paying_players[0].participant.vars['exp12_others_choice'], exp12_paying_players[0].participant.vars['exp12_others_payoff'], exp12_paying_players[0].participant.vars['exp12_my_role'], ], 'paying_player_2_exp12': [ exp12_paying_players[1].participant.label, exp12_paying_players[1].participant.vars['exp12_my_choice'], exp12_paying_players[1].participant.vars['exp12_my_payoff'], exp12_paying_players[1].participant.vars['exp12_others_choice'], exp12_paying_players[1].participant.vars['exp12_others_payoff'], exp12_paying_players[1].participant.vars['exp12_my_role'], ], } class Group(BaseGroup): pass class Player(BasePlayer): pass