from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = """communication""" import random class Constants(BaseConstants): name_in_url = 'c_redistribution70_payment_CH' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): share_payoff = models.CurrencyField() guess2_payoff = models.CurrencyField() Dice_game = models.IntegerField() Post_total = models.CurrencyField() payoff_chosen = models.CurrencyField() total_payoff = models.CurrencyField() dictator = models.IntegerField() scenario = models.CurrencyField() switch = models.IntegerField() risk_task = models.IntegerField() risk_choice = models.IntegerField() high_performer = models.IntegerField() scenario10 = models.IntegerField() def set_payoff(self): self.guess2_payoff = round(self.participant.vars['game_guess2'],2) self.share_payoff = round(self.participant.vars['game_share'],2) self.Dice_game = self.participant.vars['Dice'] self.payoff_chosen = round(self.participant.vars['game_chosen'], 2) self.Post_total = self.participant.vars['Post'] self.total_payoff =round( 10 + self.payoff_chosen + self.Post_total*0.33) self.dictator = self.participant.vars['Dictator'] self.scenario = round(self.participant.vars['Scenario']*0.1+1) self.scenario10 = self.participant.vars['Scenario'] self.switch = self.participant.vars['Switch'] self.risk_task = self.participant.vars['Dice_risk'] self.risk_choice = self.participant.vars['Choice_risk'] self.high_performer = self.participant.vars['Performer']