from otree.api import * import random doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'control2' PLAYERS_PER_GROUP = 3 NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): name = models.StringField() venmo = models.StringField() phone = models.StringField() # cannot be interger, it's easy to be out of range. payoff_1 = models.IntegerField() sum_payoff = models.IntegerField() # PAGES class Consent(Page): pass class Welcome(Page): form_model = 'player' form_fields = ['name', 'venmo', 'phone'] # A Page can have any of the 4 functions, is_displayed(), vars_for_template(), # before_next_page(), timeout_seconds class Instruction(Page): @staticmethod # before_next_page cannot appear on a waitpage, and it has to have an argument timeout_happened. def before_next_page(player, timeout_happened): if player.id_in_group == 1: player.payoff_1 = 0 player.sum_payoff = player.payoff_1+5 else: player.payoff_1 = 3 player.sum_payoff = player.payoff_1+5 #class MyWaitPage(WaitPage): #group_by_arrival_time = True #group_by_arrival_time has to be placed first in page_sequence class count1(Page): pass class count2(Page): pass class count3(Page): pass class count4(Page): pass class count5(Page): pass class count6(Page): pass class count7(Page): pass class count8(Page): pass class count9(Page): pass class count10(Page): pass class Result(Page): pass page_sequence = [Consent, Welcome, Instruction, count1, count2, count3, count4, count5, count6, count7, count8, count9, count10, Result]