Skip to content

Commit

Permalink
Change AEC last() to assert agent is not None
Browse files Browse the repository at this point in the history
Previously this would fail if AgentID was zero, which is incorrect behavior
  • Loading branch information
elliottower authored Oct 18, 2023
1 parent e06c279 commit 18dedf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pettingzoo/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 18dedf7

Please sign in to comment.