Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sugarscape_g1mt/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To run the model a single instance of the model:
To run the model with BatchRunner:

```
$ python run.py
$ python run.py -b
```

To run the model interactively:
Expand Down
2 changes: 1 addition & 1 deletion examples/sugarscape_g1mt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def assess_results(results, single_agent):
plt.plot(results_df["Step"], results_df["Trader"])
plt.show()
else:
n = max(results_df["RunID"])
n = max(results_df["RunId"])
# Plot number of Traders
for i in range(n):
results_explore = results_df[results_df["RunId"] == i]
Expand Down
16 changes: 7 additions & 9 deletions examples/sugarscape_g1mt/sugarscape_g1mt/trader_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,23 +322,21 @@ def move(self):
self.model.grid.move_agent(self, final_candidate)

def eat(self):
"""
Function for trader to consume sugar and spice in grid cell
"""

# get sugar
sugar_patch = self.get_sugar(self.pos)
# eat sugar

if sugar_patch:
self.sugar = self.sugar - self.metabolism_sugar + sugar_patch.amount
self.sugar += sugar_patch.amount
sugar_patch.amount = 0
self.sugar -= self.metabolism_sugar

# get spice
# get_spice
spice_patch = self.get_spice(self.pos)
# eat spice

if spice_patch:
self.spice = self.spice - self.metabolism_spice + spice_patch.amount
self.spice += spice_patch.amount
spice_patch.amount = 0
self.spice -= self.metabolism_spice

def maybe_die(self):
"""
Expand Down