... Step() { /* Timer */ clock++; /* map of all epucks */ CSpace::TAnyEntityMap& m_cEpucks = m_cSpace.GetEntitiesByType("epuck_entity"); /* for each robot */ for each robot cEpuck { /* Get the position of the epuck */ CVector2 EpuckPosition; EpuckPosition.Set(cEpuck.GetX(), cEpuck.GetY()); /* Calculate Objective function */ if(sqrt(pow(EpuckPosition.GetX(),2) + pow(EpuckPosition.GetY() - 0.6,2)) < 0.40f) { J += 1; } } } Real CalculateObjectiveFunction() { return J; }