Skip to content

Commit 041c593

Browse files
authored
Merge pull request #1313 from rht/fix_sugarscape_cg
fix: sugarscape_cg: Use better way to check if a cell is occupied by SsAgent
2 parents a0e5d10 + afad7cb commit 041c593

File tree

1 file changed

+1
-1
lines changed
  • examples/sugarscape_cg/sugarscape_cg

1 file changed

+1
-1
lines changed

examples/sugarscape_cg/sugarscape_cg/agents.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_sugar(self, pos):
3434

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

3939
def move(self):
4040
# Get neighborhood within vision

0 commit comments

Comments
 (0)