Skip to content

Commit e102801

Browse files
committed
Correction of Foraging LF
1 parent af9e52a commit e102801

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

loop-functions/vanilla/ForagingTwoSpotsLoopFunc.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,13 @@ argos::CColor ForagingTwoSpotsLoopFunction::GetFloorColor(const argos::CVector2&
7171
/****************************************/
7272

7373
void ForagingTwoSpotsLoopFunction::Reset() {
74-
//m_unNumberRobots = 70;
75-
CoreLoopFunctions::Reset();
74+
std::ios::sync_with_stdio(false);
7675
m_fObjectiveFunction = 0;
77-
if (m_punFoodData != NULL) {
78-
for (UInt32 i = 0; i <= m_unNumberRobots; i++) {
79-
m_punFoodData[i] = 0;
80-
}
81-
} else {
82-
m_punFoodData = new UInt32[m_unNumberRobots+1];
76+
m_punFoodData = new UInt32[m_unNumberRobots+1];
77+
for (UInt32 i = m_unNumberRobots; i <= m_unNumberRobots; i++) {
78+
m_punFoodData[i] = 0;
8379
}
80+
m_bInitializationStep = true;
8481
}
8582

8683
/****************************************/
@@ -110,7 +107,7 @@ void ForagingTwoSpotsLoopFunction::PostStep() {
110107
m_punFoodData[unId] = 1;
111108
} else if (fDistanceSpot2 <= m_fRadius){
112109
m_punFoodData[unId] = 1;
113-
} else if (cEpuckPosition.GetY() >= m_fNestLimit) {
110+
} else if (cEpuckPosition.GetY() <= m_fNestLimit) {
114111
m_fObjectiveFunction = m_fObjectiveFunction + m_punFoodData[unId];
115112
m_punFoodData[unId] = 0;
116113
}

0 commit comments

Comments
 (0)