from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from static_data.choices_data import data, gamble author = "Your name here" doc = """ Your app description """ class Constants(BaseConstants): name_in_url = "main_choices" players_per_group = None num_rounds = 15 # envelopes = data types = [gamble[i][2] for i, _ in enumerate(gamble)] endowments = [gamble[i][4] for i, _ in enumerate(gamble)] repetitions = [gamble[i][5] for i, _ in enumerate(gamble)] repetitions_words = [gamble[i][6] for i, _ in enumerate(gamble)] pictures = [gamble[i][3] for i, _ in enumerate(gamble)] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): player_choice = models.FloatField() player_choice_past = models.StringField() # risky_payoff = models.FloatField() # endow_payoff = models.FloatField() # base_endowment = models.FloatField() attention_check_1 = models.StringField() attention_check_2 = models.StringField() attention_check_3 = models.StringField() attention_check_4 = models.StringField() attention_check_5 = models.StringField() attention_check_6 = models.StringField() attention_check_7 = models.StringField() attention_check_8 = models.StringField() attention_check_9 = models.StringField() attention_check_10 = models.StringField() attention_check_11 = models.StringField() # explanation_entry_check = models.BooleanField() # def set_payoff(self, envelope, player_choice): # self.participant.vars["envelope"] = envelope # self.participant.vars["player_choice"] = player_choice # print(envelope) # self.base_endowment = envelope[0][2] # computer_threshold = envelope[0][4] # if computer_threshold >= player_choice: # self.endow_payoff = computer_threshold # else: # self.risky_payoff = 9999 # print(f"self.base_endowement: {self.base_endowment}") # print(f"self.endow_payoff: {self.endow_payoff}") # print(f"self.risky_payoff: {self.risky_payoff}")