from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Message(Page): form_model = 'player' form_fields = ['message','choice_B1','choice_B2'] def vars_for_template(self): return { 'LL': Constants.payoff_meyou_LL, 'RR': Constants.payoff_meyou_RR, 'LR': Constants.payoff_meyou_LR, 'RL': Constants.payoff_meyou_RL, } class Choice(Page): form_model = 'player' form_fields = ['message','choice_B1','choice_B2'] def vars_for_template(self): return { 'LL': Constants.payoff_meyou_LL, 'RR': Constants.payoff_meyou_RR, 'LR': Constants.payoff_meyou_LR, 'RL': Constants.payoff_meyou_RL, } class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.subsession.set_payoffs() # class Results(Page): # def vars_for_template(self): # # return { # 'my_choice': self.player.choice, # 'others_choice': self.group.get_player_by_id(self.player.id_in_group % 2 + 1).choice, # 'my_payoff': self.player.payoff, # 'other_message': Constants.B1 if self.group.get_player_by_id(self.player.id_in_group % 2 + 1).message == 1 else Constants.B2, # 'player_message': Constants.B1 if self.player.message == 1 else Constants.B2 # } class EmptyPage(Page): pass page_sequence = [ Message, #Choice, ResultsWaitPage, #Results, EmptyPage ]