from otree.api import Currency as c, currency_range from . import pages from ._builtin import Bot from .models import Constants import random class PlayerBot(Bot): cases = ['random', 'conservative', 'risky'] def play_round(self): if self.round_number == 1: yield pages.Intro yield pages.Quiz, dict(q1=True, q2=False, q3=1, q4=3, q5=4, q6=3) yield pages.TransitionToDecision work = { 'random': random.choice([True, False]), 'conservative': random.choices([True, False], [0.2, 0.8]), 'risky': random.choices([True, False], [0.8, 0.2]) }[self.case] yield pages.Decision, dict(work=work) if self.round_number == Constants.num_rounds: yield pages.Results