from otree.api import Currency as c, currency_range, expect, Bot, Submission from . import * from random import randint class PlayerBot(Bot): dice = Constants.dice q_corrects = Constants.q_corrects def play_round(self): participant = self.participant if not (participant.no_consent or participant.unmatched or participant.dropout): yield TaskRole yield TaskRule if self.participant.vars['game_role'] == Constants.roles[0]: fields = dict(report=randint(self.dice[0], self.dice[1])) if \ self.participant.vars['treatment'] != 'autoset' else dict() yield TaskDice, fields if self.participant.vars['treatment'] == 'autoset': yield TaskAutoset if self.participant.vars['game_role'] == Constants.roles[1]: fields = dict(price=randint(self.dice[0], self.dice[1])) if \ self.participant.vars['treatment'] != 'manualrand' else dict() yield TaskTrading, fields yield TaskTradingResults yield TaskResults yield NextPartIntro