Skip to content

Commit

Permalink
Merge pull request projectmesa#1313 from rht/fix_sugarscape_cg
Browse files Browse the repository at this point in the history
fix: sugarscape_cg: Use better way to check if a cell is occupied by SsAgent
  • Loading branch information
Corvince authored May 15, 2022
2 parents a0e5d10 + afad7cb commit 041c593
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/sugarscape_cg/sugarscape_cg/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_sugar(self, pos):

def is_occupied(self, pos):
this_cell = self.model.grid.get_cell_list_contents([pos])
return len(this_cell) > 1
return any(isinstance(agent, SsAgent) for agent in this_cell)

def move(self):
# Get neighborhood within vision
Expand Down

0 comments on commit 041c593

Please sign in to comment.