fix logic issues in predprey example#17
fix logic issues in predprey example#17JostMigenda wants to merge 1 commit intocarpentries-incubator:mainfrom
Conversation
Ensure prey (1) have children, which (2) aren’t predators
Thank you!Thank you for your pull request 😃 🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}. If you have files that automatically render output (e.g. R Markdown), then you should check for the following:
Rendered Changes🔍 Inspect the changes: https://github.com/carpentries-incubator/pando-python/compare/md-outputs..md-outputs-PR-17 The following changes were observed in the rendered markdown documents: What does this mean?If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible. This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation. ⏱️ Updated at 2025-11-03 07:53:10 +0000 |
|
Oops thats quite the oversight, may need to fiddle with the configuration for how much food is required to reproduce etc. |
Discovered this issue while trying to develop more interactive exercises for the optimisation part.
Right now, prey can’t have children (the function creates them, but doesn’t return them); but if they could, those would be added to the list of predators. This PR fixes both issues, ensuring more realistic behaviour. However, the downside is that the number of prey rises near-exponentially during the first steps, significantly reducing the number of steps that we can calculate in a reasonable time to about 50-ish.
I’ll also need to check how much this affects profiling results; that’s why I’m marking it as a draft for now.