from otree.api import Currency as c, currency_range, expect, Bot from . import * import numpy as np class PlayerBot(Bot): def play_round(self): if np.random.rand() < 0.5: rand_choice = self.player.left else: rand_choice = self.player.right opStrength = np.random.choice(['50%', '60%', '70%', '80%', '90%', '100%']) if self.player.choicetype == 'candy': yield (BinaryChoice, {'choice': rand_choice, 'opinionStrength': opStrength}) elif self.player.choicetype == 'party': yield (BinaryParty, {'choice': rand_choice, 'opinionStrength': opStrength}) elif self.player.choicetype == 'tversky': yield (BinaryGamble, {'choice': rand_choice, 'opinionStrength': opStrength})