Reorganize advanced examples: wolf_sheep and sugarscape_g1mt#2410
Merged
Reorganize advanced examples: wolf_sheep and sugarscape_g1mt#2410
Conversation
|
Performance benchmarks:
|
24 tasks
EwoutH
reviewed
Oct 24, 2024
|
|
||
| # Create sheep: | ||
| for i in range(self.initial_sheep): | ||
| x = self.random.randrange(self.width) |
Member
There was a problem hiding this comment.
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)
Member
Author
There was a problem hiding this comment.
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]>
Member
Author
I forgot that folder. The rest is clean |
EwoutH
approved these changes
Oct 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.