Spaces:
Paused
Paused
| from otree.api import Bot, Submission | |
| from . import Introduction, Decision, Results | |
| class PlayerBot(Bot): | |
| def play_round(self): | |
| # Simulate a timeout on the intro page to exercise timeout handling | |
| yield Submission(Introduction, {}, timeout_happened=True) | |
| # Player 1 cooperates, Player 2 defects to cover both branches | |
| if self.player.id_in_group == 1: | |
| yield Submission(Decision, {'cooperate': True}) | |
| else: | |
| yield Submission(Decision, {'cooperate': False}) | |
| yield Results | |