Skip to content

Commit

Permalink
fix: Use new API to loop over agents_by_type
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Jan 11, 2024
1 parent d97bbea commit b0ac96c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/sugarscape_g1mt/sugarscape_g1mt/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def step(self):
and then randomly activates traders
"""
# step Resource agents
for resource in self.schedule.agents_by_type[Resource].values():
for resource in self.schedule.agents_by_type[Resource]:
resource.step()

# step trader agents
Expand Down
2 changes: 1 addition & 1 deletion examples/wolf_sheep/wolf_sheep/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_type_count(
that satisfy the filter function.
"""
count = 0
for agent in self.agents_by_type[type_class].values():
for agent in self.agents_by_type[type_class]:
if filter_func is None or filter_func(agent):
count += 1
return count

0 comments on commit b0ac96c

Please sign in to comment.