File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,18 +101,25 @@ def _cycle(self):
101101 self .reset = False
102102 total_rew = [0 ] * self .n_agents
103103
104- action_list = [[0.0 ] * agent .action_size for agent in self .agents ]
105- action_list [self .current_agent_index ] = self .u [
106- : self .agents [self .current_agent_index ].action_size
107- ]
104+ if self .n_agents > 0 :
105+ action_list = [[0.0 ] * agent .action_size for agent in self .agents ]
106+ action_list [self .current_agent_index ][
107+ : self .agents [self .current_agent_index ].dynamics .needed_action_size
108+ ] = self .u [
109+ : self .agents [self .current_agent_index ].dynamics .needed_action_size
110+ ]
111+ else :
112+ action_list = []
108113
109114 if self .n_agents > 1 and self .control_two_agents :
110- action_list [self .current_agent_index2 ] = self .u2 [
111- : self .agents [self .current_agent_index2 ].action_size
115+ action_list [self .current_agent_index2 ][
116+ : self .agents [self .current_agent_index2 ].dynamics .needed_action_size
117+ ] = self .u2 [
118+ : self .agents [self .current_agent_index2 ].dynamics .needed_action_size
112119 ]
113120 obs , rew , done , info = self .env .step (action_list )
114121
115- if self .display_info :
122+ if self .display_info and self . n_agents > 0 :
116123 # TODO: Determine number of lines of obs_str and render accordingly
117124 obs_str = str (InteractiveEnv .format_obs (obs [self .current_agent_index ]))
118125 message = f"\t \t { obs_str [len (obs_str ) // 2 :]} "
You can’t perform that action at this time.
0 commit comments