Skip to content

Commit 0f032b3

Browse files
rhttpike3
authored andcommitted
color_patches: Rename _schedule to schedule
1 parent e1f67c1 commit 0f032b3

File tree

1 file changed

+3
-13
lines changed
  • examples/color_patches/color_patches

1 file changed

+3
-13
lines changed

examples/color_patches/color_patches/model.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, width=20, height=20):
7373
"""
7474
super().__init__()
7575
self._grid = mesa.space.SingleGrid(width, height, torus=False)
76-
self._schedule = mesa.time.SimultaneousActivation(self)
76+
self.schedule = mesa.time.SimultaneousActivation(self)
7777

7878
# self._grid.coord_iter()
7979
# --> should really not return content + col + row
@@ -85,15 +85,15 @@ def __init__(self, width=20, height=20):
8585
(row, col), self, ColorCell.OPINIONS[self.random.randrange(0, 16)]
8686
)
8787
self._grid.place_agent(cell, (row, col))
88-
self._schedule.add(cell)
88+
self.schedule.add(cell)
8989

9090
self.running = True
9191

9292
def step(self):
9393
"""
9494
Advance the model one step.
9595
"""
96-
self._schedule.step()
96+
self.schedule.step()
9797

9898
# the following is a temporary fix for the framework classes accessing
9999
# model attributes directly
@@ -117,13 +117,3 @@ def grid(self):
117117
AttributeError: 'ColorPatches' object has no attribute 'grid'
118118
"""
119119
return self._grid
120-
121-
@property
122-
def schedule(self):
123-
"""
124-
mesa_ABM/examples_ABM/color_patches/mesa/visualization/ModularVisualization.py",
125-
line 278, in run_model
126-
while self.model.schedule.steps < self.max_steps and self.model.running:
127-
AttributeError: 'NoneType' object has no attribute 'steps'
128-
"""
129-
return self._schedule

0 commit comments

Comments
 (0)