from . import models from ._builtin import Page, WaitPage from otree.api import Currency as c, currency_range from .models import Constants class GroupingWait(WaitPage): pass class Introduction(Page): """Description of the game: How to play and returns expected""" def is_displayed(self): return self.subsession.round_number == 1 form_model = models.Player form_fields = ['secretword'] def vars_for_template(self): step = (self.session.config['players_per_group'] * Constants.step_per_person) ppg = self.session.config['players_per_group'] return {'step': step, 'ppg': ppg} class Introduction2(Page): """Description of the game: How to play and returns expected""" def is_displayed(self): return self.subsession.round_number > 1 def before_next_page(self): self.player.secretword = self.player.in_round(1).secretword class Contribute(Page): """Player: Choose how much to contribute""" form_model = models.Player form_fields = ['contribution'] class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() body_text = "Waiting for other participants to make a decision." class Results(Page): """Players payoff: How much each has earned""" def vars_for_template(self): step = (self.session.config['players_per_group'] * Constants.step_per_person) if self.player.threshold_reached == True: higherorlower = "higher" willorwillnot = "will" if self.player.threshold_reached == False: higherorlower = "lower" willorwillnot = "will NOT" return {'step': step, 'higherorlower': higherorlower, 'willorwillnot': willorwillnot} page_sequence = [ GroupingWait, Introduction, Introduction2, Contribute, ResultsWaitPage, Results ]