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; } }
public void iterate() { for (BiologicalObject c : cells) { c.move(); scoreToTargets(c); } }