from . import models from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class Introduction(Page): def is_displayed(self): return self.subsession.round_number == 1 class IntroductionA(Page): #timeout_seconds = def is_displayed(self): return self.player.role() == 'A' class IntroductionB(Page): #timeout_seconds = def is_displayed(self): return self.player.role() == 'B' class DecisionA(Page): form_model = models.Group form_fields = ['beer'] def vars_for_template(self): return { 'announcement': self.group.announcement } def is_displayed(self): return self.player.role() == 'A' class SignalWaitPage(WaitPage): def vars_for_template(self): if self.player.role() == 'B': body_text = "You are Participant B. Waiting for Participant A to make a choice." else: body_text = "Waiting for Participant B." return {'body_text': body_text} class DecisionB(Page): form_model = models.Group form_fields = ['duel'] def vars_for_template(self): return { 'beer_quiche': self.group.beer } def is_displayed(self): return self.player.role() == 'B' class DuelWaitPage(WaitPage): def vars_for_template(self): if self.player.role() == 'A': body_text = "You are Participant A. Waiting for Participant B to make a choice." else: body_text = "Waiting for Participant A." return {'body_text': body_text} class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): def vars_for_template(self): #self.group.average_guess() #self.group.set_groups() return { 'payoff': self.player.payoff, 'announcement': self.group.announcement } page_sequence = [ Introduction, #IntroductionA, #IntroductionB, DecisionA, SignalWaitPage, DecisionB, DuelWaitPage, ResultsWaitPage, Results, ]