Skip to content

Commit cd09aba

Browse files
committed
Fix Sugarscape G1MT app.py to use Resource instead
1 parent 9deafba commit cd09aba

File tree

1 file changed

+6
-6
lines changed
  • examples/sugarscape_g1mt

1 file changed

+6
-6
lines changed

examples/sugarscape_g1mt/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from matplotlib.figure import Figure
44
from mesa.experimental import JupyterViz
55
from sugarscape_g1mt.model import SugarscapeG1mt
6-
from sugarscape_g1mt.resource_agents import Sugar
76
from sugarscape_g1mt.trader_agents import Trader
87

98

@@ -22,11 +21,12 @@ def portray(g):
2221
layers["trader"]["y"].append(j)
2322
else:
2423
# Don't visualize resource with value <= 1.
25-
value = agent.amount if agent.amount > 1 else np.nan
26-
if isinstance(agent, Sugar):
27-
layers["sugar"][i][j] = value
28-
else:
29-
layers["spice"][i][j] = value
24+
layers["sugar"][i][j] = (
25+
agent.sugar_amount if agent.sugar_amount > 1 else np.nan
26+
)
27+
layers["spice"][i][j] = (
28+
agent.spice_amount if agent.spice_amount > 1 else np.nan
29+
)
3030
return layers
3131

3232
fig = Figure()

0 commit comments

Comments
 (0)