Skip to content
Snippets Groups Projects
Commit 8784f512 authored by Egli Adrian (IT-SCI-API-PFI)'s avatar Egli Adrian (IT-SCI-API-PFI)
Browse files

demo cleaned up

parent f2fd71be
No related branches found
No related tags found
No related merge requests found
...@@ -107,39 +107,23 @@ class Demo: ...@@ -107,39 +107,23 @@ class Demo:
# Action # Action
for iAgent in range(self.env.get_num_agents()): for iAgent in range(self.env.get_num_agents()):
# allways walk straight forward
action = 2 action = 2
if False: # update the actions
if not ((step) % 2 == 0):
if iAgent == 3:
action = 0
if not ((step) % 2 == 0):
if iAgent == 4:
action = 0
if False:
agent = self.env.agents[iAgent]
trial = 0
while not self.env.check_action(agent, action)[1]:
action = np.random.choice(self.action_size)
trial += 1
if trial > 10:
break
action_dict.update({iAgent: action}) action_dict.update({iAgent: action})
self.renderer.renderEnv(show=True) # environment step (apply the actions to all agents)
# Environment step
next_obs, all_rewards, done, _ = self.env.step(action_dict) next_obs, all_rewards, done, _ = self.env.step(action_dict)
# render
self.renderer.renderEnv(show=True)
if done['__all__']: if done['__all__']:
break break
if self.record_frames is not None: if self.record_frames is not None:
self.renderer.gl.saveImage(self.record_frames.format(step)) self.renderer.gl.saveImage(self.record_frames.format(step))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment