How can I embody my biological idea through Processing 3?

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,

  1. 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.
  2. They hit each other, and when they hit, a new ball is created. ( I considered this as a cross. )
  3. The color of the new ball depends on the color of the parent ball.
  4. Observe the ratio of the colors of the entire ball over time.

Here’s the question.

  1. I’ve finished marking ball as objects using class, but what should I do to create a new ball when two ball meet?
  2. How can I designate the color of the new ball?