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 TaskDicePart3, fields if self.participant.vars['treatment'] == 'autoset': yield TaskAutosetPart3 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 TaskTradingPart3, fields yield TaskTradingResultsPart3 if self.round_number == Constants.num_rounds: yield TaskResultsIntro yield TaskResults