I just planned a new computer science subject project for my homework. For my coding project homework, I’m going to prove Hardy-Bainberg’s law through processing 3.
I am proceeding with the example attached below by modifying it, and I would like to think of the ball as a living organism. To sum up my project,
- About 10 ball exist early on and they exercise in random directions at a constant speed. They are distinguished by color, and black is dominant phenotype and white is recessive phenotype.
- They hit each other, and when they hit, a new ball is created. ( I considered this as a cross. )
- The color of the new ball depends on the color of the parent ball.
- Observe the ratio of the colors of the entire ball over time.
Here’s the question.
- I’ve finished marking ball as objects using class, but what should I do to create a new ball when two ball meet?
- How can I designate the color of the new ball?