From 5bf9186fa78990628f919e9da6d2ab21eb603e75 Mon Sep 17 00:00:00 2001 From: williamcorsel <31770711+williamcorsel@users.noreply.github.com> Date: Mon, 10 May 2021 22:52:44 +0200 Subject: [PATCH] Update slimevolley.py Ensures otherAction is converted when using atari mode and a multi-agent setup --- slimevolleygym/slimevolley.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/slimevolleygym/slimevolley.py b/slimevolleygym/slimevolley.py index bc26901..8c31bf3 100644 --- a/slimevolleygym/slimevolley.py +++ b/slimevolleygym/slimevolley.py @@ -775,15 +775,15 @@ def step(self, action, otherAction=None): if self.otherAction is not None: otherAction = self.otherAction + + if otherAction is None: # override baseline policy + obs = self.game.agent_left.getObservation() + otherAction = self.policy.predict(obs) if self.atari_mode: action = self.discreteToBox(action) - if otherAction is not None: - otherAction = self.discreteToBox(otherAction) + otherAction = self.discreteToBox(otherAction) - if otherAction is None: # override baseline policy - obs = self.game.agent_left.getObservation() - otherAction = self.policy.predict(obs) self.game.agent_left.setAction(otherAction) self.game.agent_right.setAction(action) # external agent is agent_right