from otree.api import expect, Bot from . import * class PlayerBot(Bot): def play_round(self): if not hasattr(self.participant, 'timed_out'): self.participant.timed_out = False if not hasattr(self.participant, 'uid'): self.participant.uid = 1 # Seed market order so get_market_data() can index into it # (the pkl has one market per round: 0..C.NUM_ROUNDS-1) if not hasattr(self.participant, 'mkt_ord'): self.participant.mkt_ord = list(range(C.NUM_ROUNDS)) # Bot ranks both allowed islands (C.NUM_CAP == 2); belief fields # are positional (belief1, belief2) yield Ranks, dict( rank1='A', rank2='B', smt_ct=0, ) yield ExpectedPayoff, dict( expected_payoff=150, ep_smt_ct=0, ) yield Beliefs, dict( belief1=80, belief2=20, belief0=0, belief_smt_ct=0, ) yield Summary if self.round_number == C.NUM_ROUNDS: yield Approach, dict(approach='I ranked islands by expected payoff.')