Exemple #1
0
 public void scoreToTargets(BiologicalObject c) {
   double distanceX, distanceY, distanceSq;
   for (Target t : targets) {
     distanceX = c.xPos - t.xPos;
     distanceY = c.yPos - t.yPos;
     distanceSq = (distanceX * distanceX) + (distanceY * distanceY);
     c.score += 1 / distanceSq;
   }
 }
Exemple #2
0
 public void iterate() {
   for (BiologicalObject c : cells) {
     c.move();
     scoreToTargets(c);
   }
 }