Saturday, March 27, 2021

Ask HN: How would I use a proglang to simulate a system with interaction?

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?


Comments URL: https://news.ycombinator.com/item?id=26606820

Points: 1

# Comments: 1



from Hacker News: Newest https://ift.tt/3fldJ2L
via IFTTT

No comments:

Post a Comment

Tool to teleport your HTTP requests to different Cloudflare datacenters

Article URL: https://github.com/hackermondev/cf-teleport Comments URL: https://news.ycombinator.com/item?id=42832616 Points: 2 # Comments...