Skip to content

Commit

Permalink
Update agents.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vbv-shm authored Nov 27, 2024
1 parent 0138b0b commit 7c7513b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mesa/examples/basic/schelling/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def step(self) -> None:
self.pos, moore=True, radius=self.model.radius
)

neighborsboolean = [neighbor.type == self.type for neighbor in neighbors]
type_of_neighbors = [neighbor.type == self.type for neighbor in neighbors]

# Count similar neighbors
similar = sum(neighborsboolean)
similar = sum(type_of_neighbors)

# Count total neighbors
total_neighbors = len(neighborsboolean)
total_neighbors = len(type_of_neighbors)

# If unhappy, move to a random empty cell:
if (
Expand Down

0 comments on commit 7c7513b

Please sign in to comment.