import random from otree.api import * doc = """ The principal offers a contract to the agent, who can decide if to reject or accept. The agent then chooses an effort level. The implementation is based on Gaechter and Koenigstein (2006) . """ # """Define shuffling method""" class Subsession(BaseSubsession): pass # """Define constants""" class C(BaseConstants): NAME_IN_URL = "shareholder_manager_DE_Before" PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 PW = "start123" INSTRUCTIONS_TEMPLATE = "shareholder_manager_DE_Before/Instructions.html" class Group(BaseGroup): pass class Player(BasePlayer): start_pw = models.StringField() # FUNCTIONS # PAGES class Introduction(Page): @staticmethod def is_displayed(player: Player): return player.round_number == 1 form_model = "player" form_fields = ["start_pw"] @staticmethod def error_message(player: Player, values): if values["start_pw"] != C.PW: return "The password is not correct." page_sequence = [ Introduction, ]