The Capsis training online
Try to work with the helping elements before looking at the solution…
Helping elements
TraModel
regenerationAroundMothers(TraScene newScene)
and call it instead of regeneration()
processEvolution ()
for the growthgetAge () > 20
double maxDistance = mother.getHeight () / 2d;
x0 = mother.getX ()
distance = random.nextDouble () * maxDistance;
alpha = random.nextDouble () * 2 * Math.PI;
x = x0 + Math.cos (alpha) * distance;
(same for y
with sin()
)A possible solution