from otree.api import Currency as c, currency_range from . import pages from ._builtin import Bot from .models import Constants class PlayerBot(Bot): def play_round(self): if self.round_number == 1: yield (pages.grouping_and_cost) if self.participant.vars['group_id'] == (self.round_number % 3): yield (pages.start_of_round) if self.participant.vars['donation_cost'] > c(1): yield (pages.donation_decision, {'is_donor': False}) else: yield (pages.donation_decision, {'is_donor': True}) if self.round_number != 1 and self.participant.vars['group_id'] == ((self.round_number - 1) % 3): yield (pages.results_display_forSeniors) if self.participant.vars['group_id'] == (self.round_number % 3): yield (pages.results_display) if self.round_number == Constants.num_rounds: yield (pages.final_results)