from otree.api import expect, Bot from . import * class PlayerBot(Bot): def play_round(self): # uid=1 (odd) → nocap in block 1, cap in block 2 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 lists so get_market_data() can index into them mkt_keys = list(MARKETS.keys()) if not hasattr(self.participant, 'mkt_ord_nocap'): self.participant.mkt_ord_nocap = mkt_keys[:C.NUM_ROUNDS_PER_BLOCK] if not hasattr(self.participant, 'mkt_ord_cap'): self.participant.mkt_ord_cap = mkt_keys[C.NUM_ROUNDS_PER_BLOCK:C.NUM_ROUNDS_PER_BLOCK * 2] treatment = get_treatment(self.player) is_intro_round = self.round_number in (1, C.NUM_ROUNDS_PER_BLOCK + 1) if is_intro_round: if treatment == 'cap': yield Intro_Cap else: yield Intro_NoCap # Bot ranks 2 islands; 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_PER_BLOCK: yield Approach, dict(approach_block1='I ranked islands by expected payoff.') elif self.round_number == C.NUM_ROUNDS: yield Approach, dict(approach_block2='I continued with the same strategy.')