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 7, 2024
2 parents 93349bb + 0bc3965 commit 5babcfc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def __init__(self, num_agents=7, num_nodes=10):
self.num_agents = num_agents
self.num_nodes = num_nodes if num_nodes >= self.num_agents else self.num_agents
self.G = nx.erdos_renyi_graph(n=self.num_nodes, p=0.5)
self.grid = mesa.experimental.cell_space.Network(self.G, random=self.random, capacity=1)
self.grid = mesa.experimental.cell_space.Network(
self.G, random=self.random, capacity=1
)

self.datacollector = mesa.DataCollector(
model_reporters={"Gini": compute_gini},
Expand Down
4 changes: 3 additions & 1 deletion examples/color_patches/color_patches/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def __init__(self, width=20, height=20):
The agents next state is first determined before updating the grid
"""
super().__init__()
self._grid = mesa.experimental.cell_space.OrthogonalMooreGrid((width, height), torus=False)
self._grid = mesa.experimental.cell_space.OrthogonalMooreGrid(
(width, height), torus=False
)

# self._grid.coord_iter()
# --> should really not return content + col + row
Expand Down
4 changes: 3 additions & 1 deletion examples/conways_game_of_life/conways_game_of_life/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def __init__(self, width=50, height=50):
"""
super().__init__()
# Use a simple grid, where edges wrap around.
self.grid = mesa.experimental.cell_space.OrthogonalMooreGrid((width, height), torus=True)
self.grid = mesa.experimental.cell_space.OrthogonalMooreGrid(
(width, height), torus=True
)

# Place a cell at each location, with some initialized to
# ALIVE and some to DEAD.
Expand Down

0 comments on commit 5babcfc

Please sign in to comment.