# 乱序测试:调换了table_list每一行的最末尾2个id from collections import OrderedDict from tradeoff import * class PlayerBot(Bot): def play_round(self): # 自定义table_list table_list = [ # 1. Part I Left 1101, 1102, 1103, # 2. Part II Left 2101, 2103, 2107, 2109, 2113, 2115, # 3. Part III Left 3101, 3102, 3103, 3107, 3108, 3109, 3113, 3114, 3115, # # 4. Part I Right # 1201, 1202, 1203, # # # 5. Part II Right # 2201, 2203, 2207, 2209, 2213, 2215, # # # 6. Part III Right # 3201, 3202, 3203, 3207, 3208, 3209, 3213, 3214, 3215, ] sp_list = [ 85, 90, 100, 85, 85, 90, 90, 100, 100, 85, 85, 85, 90, 90, 90, 100, 100, 100 ] table_sp = OrderedDict({1101: 85, 1102: 90, 1103: 100}) # round_number = self.round_number print(self.round_number) print(len(table_list)) if self.round_number > len(table_list): return # print(self.round_number) # ====================== # part I开始 # ====================== if self.round_number == 1: self.participant.vars['table_list'] = table_list.copy() self.participant.vars['num_rounds'] = len(table_list) yield Intro yield Intro2 yield Question table_id = self.participant.vars['table_list'][self.round_number - 1] # print(table_id) part = int(math.floor(table_id / 1000)) is_left = str(table_id)[1] == "1" # print(f'part: {part}, is_left: {is_left}') sp = sp_list[self.round_number - 1] if (part == 1) & is_left: yield P1Left, dict(sp=sp) if (part == 2) & is_left: yield P2Left, dict(sp=sp) if (part == 3) & is_left: yield P3Left, dict(sp=sp) # print(f"{part == 3 & is_left}") # if part == 3 & is_left: # print("hello") # # if self.round_number == len(self.participant.vars['table_list']): # yield Survey, dict( # phonenumber=1234567890, # name="asdf", # gender="adsf", # major="adsf", # grade="大一", # GPA=123, # E1=1, # E2=1, # E3=1, # E4=1, # E5=1, # E6=1, # E7=1, # E8=1, # E9=1, # E10=1, # E11=1, # E12=1 # ) # # yield Lottery # # print(self.participant.vars) # yield Results #