from otree.api import * c = Currency # old name for currency; you can delete this. class Constants(BaseConstants): name_in_url = 'intro_real_effort' players_per_group = None num_rounds = 1 fish = 55 mushrooms = 10 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): fish = models.IntegerField( label=''' In the summer of 2021, a pond is inhabited by 50 fish. If a year after the stock has grown by 5 units, how many fish will there be in the summer of 2022?''' ) mushrooms = models.IntegerField( label=''' If you have a bucket with 5 mushrooms and each mushroom is worth 2 US$, how much money would you get if you sold all your mushrooms? ''' ) # FUNCTIONS # PAGES class Introduction(Page): pass class AttentionCheck(Page): form_model = 'player' form_fields = ['fish', 'mushrooms'] timeout_seconds = 60 class Mistake(Page): def is_displayed(player: Player): if player.fish != Constants.fish or player.mushrooms != Constants.mushrooms: return True class Results(Page): @staticmethod def is_displayed(player: Player): if player.fish == Constants.fish and player.mushrooms == Constants.mushrooms: return True timeout_seconds = 20 page_sequence = [Introduction, AttentionCheck, Mistake, Results]