From 18dedf766e0340672ddaa04c673ff70cec8e9d59 Mon Sep 17 00:00:00 2001 From: Elliot Tower Date: Wed, 18 Oct 2023 12:00:20 -0400 Subject: [PATCH] Change AEC last() to assert agent is not None Previously this would fail if AgentID was zero, which is incorrect behavior --- pettingzoo/utils/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pettingzoo/utils/env.py b/pettingzoo/utils/env.py index 3889ee01e..00523856b 100644 --- a/pettingzoo/utils/env.py +++ b/pettingzoo/utils/env.py @@ -182,7 +182,7 @@ def last( ) -> tuple[ObsType | None, float, bool, bool, dict[str, Any]]: """Returns observation, cumulative reward, terminated, truncated, info for the current agent (specified by self.agent_selection).""" agent = self.agent_selection - assert agent + assert agent is not None observation = self.observe(agent) if observe else None return ( observation,