Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: How would I use a proglang to simulate a system with interaction?
2 points by Konohamaru on March 28, 2021 | hide | past | favorite | 2 comments
For instance, a predator-prey systems between predator species X and prey species Y. There is a birthing process where two Y's of opposite gender meet together and have children. There is a predation process where an X eat Y's. And maybe some others.

I thought "maybe an object oriented language would be good for this." So I created Predator & Prey classes. But then when it came to instantiating the objects it quickly became stupid. What am I supposed to do to model the ACTUAL OBJECTS themselves? Two ArrayLists one with m predators and n prey? A two-dimensional array with Predator and Prey objects dispersed randomly and moving stepwise?

How do you model simple INTERACTION between objects?




Did you look at Netlogo it is designed specially for this kind of simulation.


No, I'll give it a whirl.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: