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.round_number == 1 class instruction1(Page): def is_displayed(self): return self.round_number == 1 class instruction2(Page): def is_displayed(self): return self.round_number == 1 class instruction3(Page): def is_displayed(self): return self.round_number == 1 class instruction4(Page): def is_displayed(self): return self.round_number == 1 class instruction5(Page): def is_displayed(self): return self.round_number == 1 class Decision(Page): form_model = 'player' form_fields = ['decision'] def vars_for_template(self): return dict( round_number=self.round_number ) class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): for p in self.group.get_players(): p.set_payoff() class Results(Page): def vars_for_template(self): me = self.player opponent = me.other_player() return dict( my_decision=me.decision, opponent_decision=opponent.decision, round_number=self.round_number, self_total_payoff=sum([me.payoff for me in me.in_all_rounds()]), opponent_total_payoff=sum([opponent.payoff for opponent in opponent.in_all_rounds()]) ) page_sequence = [Introduction, instruction1, instruction2, instruction3, instruction4, instruction5, Decision, ResultsWaitPage, Results]