We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae0223b commit 8b3a415Copy full SHA for 8b3a415
mesa/examples/advanced/wolf_sheep/agents.py
@@ -40,6 +40,12 @@ def step(self):
40
"""Execute one step of the animal's behavior."""
41
# Move to random neighboring cell
42
self.move()
43
+ is_cliff = self.grid.model.cliff.data[self.cell.coordinate[0]][
44
+ self.cell.coordinate[1]
45
+ ]
46
+ if is_cliff: # if the cell is a cliff, then the animal dies
47
+ self.remove()
48
+ return
49
50
self.energy -= 1
51
0 commit comments