Spaces:
Paused
Paused
Download prisoner/tests.py from BPEL/otree-server: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/spaces/BPEL/otree-server/resolve/main/prisoner/tests.py
- Command line
-
hf download hf://spaces/BPEL/otree-server/prisoner/tests.py
-
curl -L -o tests.py https://huggingface.co/spaces/BPEL/otree-server/resolve/main/prisoner/tests.py
545 Bytes
| 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 | |