-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize advanced examples: wolf_sheep and sugarscape_g1mt #2410
Conversation
for more information, see https://pre-commit.ci
Performance benchmarks:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
# Create sheep: | ||
for i in range(self.initial_sheep): | ||
x = self.random.randrange(self.width) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t we have a nice random cell function for this?
(can also be done in another PR, but now that we’re looking at it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you can do self.grid.all_cells.select_random_empty_cell()
or something close to that.
I'll leave that for a seperate PR that goes into the code itself and cleans it up. Let's keep this focussed on the reorganization.
Co-authored-by: Ewout ter Hoeven <[email protected]>
I forgot that folder. The rest is clean |
This PR reorganizes wolf_sheep and sugarscae_g1mt using agents.py, model.py, and app.py. It cleanup redundant files and updates the readme. For wolf_sheep, it adds a Solara front end because it did not exist yet.
Below is a screenshot. Grass visualization is not great yet. The matplotlib drawing of agents passes
s
(the size of the marker) but notmarker
(the shape of the marker). So various updates in the solara side are needed first before we can return to make this solara front end nicer.Note how I reused #2408 for the dropdown chooser for grass regrowth.