Skip to content

Commit

Permalink
Merge branch 'new_spaces' of https://github.com/quaquel/mesa-examples
Browse files Browse the repository at this point in the history
…into new_spaces
  • Loading branch information
quaquel committed Oct 12, 2024
2 parents 1f48f43 + 3ca8538 commit b124cbf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/wolf_sheep/wolf_sheep/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
grass=False,
grass_regrowth_time=30,
sheep_gain_from_food=4,
seed=None
seed=None,
):
"""
Create a new Wolf-Sheep model with the given parameters.
Expand Down Expand Up @@ -93,14 +93,16 @@ def __init__(
x = self.random.randrange(self.width)
y = self.random.randrange(self.height)
energy = self.random.randrange(2 * self.sheep_gain_from_food)
Sheep(self, energy, sheep_reproduce, sheep_gain_from_food, self.grid[(x,y)])
Sheep(
self, energy, sheep_reproduce, sheep_gain_from_food, self.grid[(x, y)]
)

# Create wolves
for _ in range(self.initial_wolves):
x = self.random.randrange(self.width)
y = self.random.randrange(self.height)
energy = self.random.randrange(2 * self.wolf_gain_from_food)
Wolf(self, energy, wolf_reproduce, wolf_gain_from_food, self.grid[(x,y)])
Wolf(self, energy, wolf_reproduce, wolf_gain_from_food, self.grid[(x, y)])

# Create grass patches
if self.grass:
Expand Down

0 comments on commit b124cbf

Please sign in to comment.