from otree.api import * doc = """ centipede game tree testing """ class C(BaseConstants): NAME_IN_URL = 'graph_testing' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 GRAPH_TEMPLATE = 'graph_testing/graph_three.html' class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): stop = models.BooleanField(initial=False) tmp = models.BooleanField(blank=True) # PAGES def graph_parameters(node): return dict( cont_rect_x = 45 + (node - 1) * 100, cont_text_x = 59 + (node - 1) * 100, stop_rect_x = 1 + (node - 1) * 100, stop_text_x = 15 + (node - 1) * 100, color_hover = 'LightPink' if node % 2 == 1 else 'LightSkyBlue', color_active = 'red' if node % 2 == 1 else 'blue', ) class GameStart(Page): form_model = 'player' form_fields = ['stop', 'tmp'] @staticmethod def vars_for_template(player): return graph_parameters(node=1) class ResultsWaitPage(WaitPage): pass # after_all_players_arrive = 'do_something' class Results(Page): pass # @staticmethod # def is_displayed(player): # return player.id_in_group == 1 page_sequence = [ GameStart, Results ]