from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random class Constants(BaseConstants): name_in_url = 'survey2_new' players_per_group = None num_rounds = 10 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def choices(): choice00000 = (60, 15, 20, 30) return choice00000 def budget(): budget00000 = (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) return budget00000 class Player(BasePlayer): baseline = models.IntegerField() correct = models.IntegerField() my_page_timeout_seconds = models.FloatField(min=0) payoff1 = models.FloatField(min=0, max=50) time_spent = models.FloatField() starting_budget = models.IntegerField() choice1 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], ], label="", widget=widgets.RadioSelectHorizontal ) choice2 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[1])], ], label="", widget=widgets.RadioSelectHorizontal ) choice3 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[2])], ], label="", widget=widgets.RadioSelectHorizontal ) choice4 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[3])], ], label="", widget=widgets.RadioSelectHorizontal ) choice5 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[4])], ], label="", widget=widgets.RadioSelectHorizontal ) choice6 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[5])], ], label="", widget=widgets.RadioSelectHorizontal ) choice7 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[6])], ], label="", widget=widgets.RadioSelectHorizontal ) choice8 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[7])], ], label="", widget=widgets.RadioSelectHorizontal ) choice9 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[8])], ], label="", widget=widgets.RadioSelectHorizontal ) choice10 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[9])], ], label="", widget=widgets.RadioSelectHorizontal ) choice11 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[1]), str(choices()[1]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[10])], ], label="", widget=widgets.RadioSelectHorizontal ) choice12 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], ], label="", widget=widgets.RadioSelectHorizontal ) choice13 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[1])], ], label="", widget=widgets.RadioSelectHorizontal ) choice14 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[2])], ], label="", widget=widgets.RadioSelectHorizontal ) choice15 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[3])], ], label="", widget=widgets.RadioSelectHorizontal ) choice16 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[4])], ], label="", widget=widgets.RadioSelectHorizontal ) choice17 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[5])], ], label="", widget=widgets.RadioSelectHorizontal ) choice18 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[6])], ], label="", widget=widgets.RadioSelectHorizontal ) choice19 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[7])], ], label="", widget=widgets.RadioSelectHorizontal ) choice20 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[8])], ], label="", widget=widgets.RadioSelectHorizontal ) choice21 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[9])], ], label="", widget=widgets.RadioSelectHorizontal ) choice22 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[2]), str(choices()[2]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[10])], ], label="", widget=widgets.RadioSelectHorizontal ) choice23 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], ], label="", widget=widgets.RadioSelectHorizontal ) choice24 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[1])], ], label="", widget=widgets.RadioSelectHorizontal ) choice25 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[2])], ], label="", widget=widgets.RadioSelectHorizontal ) choice26 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[3])], ], label="", widget=widgets.RadioSelectHorizontal ) choice27 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[4])], ], label="", widget=widgets.RadioSelectHorizontal ) choice28 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[5])], ], label="", widget=widgets.RadioSelectHorizontal ) choice29 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[6])], ], label="", widget=widgets.RadioSelectHorizontal ) choice30 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[7])], ], label="", widget=widgets.RadioSelectHorizontal ) choice31 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[8])], ], label="", widget=widgets.RadioSelectHorizontal ) choice32 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[9])], ], label="", widget=widgets.RadioSelectHorizontal ) choice33 = models.StringField( choices=[ [str(choices()[0]), str(choices()[0]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[0])], [str(choices()[3]), str(choices()[3]) + ' seconds per game with a starting budget of \N{pound sign}' + str(budget()[10])], ], label="", widget=widgets.RadioSelectHorizontal ) choice34 = models.StringField( choices=[ [str(choices()[0]), 'Compete with a time limit of ' + str(choices()[0]) + ' seconds per game against the past performance of someone who also had a time limit of ' + str(choices()[0]) + ' seconds per game'], [str(choices()[1]), 'Compete with a time limit of ' + str(choices()[1]) + ' seconds per game against the past performance of someone who also had a time limit of ' + str(choices()[1]) + ' seconds per game'], ], label="", widget=widgets.RadioSelectHorizontal )