from otree.api import Currency as c, currency_range from . import * from otree.api import Bot class PlayerBot(Bot): cases = ['diff', 'same'] def play_round(self): if self.round_number == 1: yield (Introduction) if self.case == 'diff': if self.player.id_in_group == 1: yield (Main, {'choice': 1}) assert self.player.payoff == cu(15) else: yield (Main, {'choice': 3}) assert self.player.payoff == 0 yield (Results) if self.round_number == 5: assert 'You won' in self.html if self.player.id_in_group == 1 else 'You did not win' in self.html yield (Final) else: yield (Main, {'choice': 2}) assert self.player.payoff == 9 yield (Results) if self.round_number == 5: assert 'You tied' in self.html yield (Final)