from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class IDinput(Page): form_model = 'player' form_fields = ['ID_number'] timeout_seconds = 600 class WaitforStart(WaitPage): wait_for_all_groups = True class StartStage2(Page): timeout_seconds = 60 class Introduction(Page): timeout_seconds = 300 class Offer(Page): form_model = 'group' form_fields = ['amount_offered'] def is_displayed(self): return self.player.id_in_group == 1 class WaitForProposer(WaitPage): pass class AcceptStrategy(Page): form_model = 'group' form_fields = ['response_{}'.format(int(i)) for i in Constants.offer_choices] def is_displayed(self): return self.player.id_in_group == 2 class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() class AllWait(WaitPage): wait_for_all_groups = True class Results(Page): pass page_sequence = [WaitforStart, StartStage2, Offer, AcceptStrategy, ResultsWaitPage, AllWait, Results]