from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, Page, WaitPage ) cu = c doc = '' class Constants(BaseConstants): name_in_url = 'wtp' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def set_brico(player): import random options = [True, False] brico = random.choice(options) print(brico) return brico class Player(BasePlayer): willingness_to_pay = models.CurrencyField(label='What is your willingness to pay?', max=5, min=0) brico = models.BooleanField() paid = models.BooleanField() outcome_card = models.StringField() total = models.CurrencyField() r1_earnings = models.CurrencyField() payment = models.CurrencyField() set_brico = set_brico