Quote:
|
In the robot step method, you need to call the energySourceAt accessor for the valley object for this robot, to determine if there is an energy source at the current location.
|
You are right, I was thinking about that too.
if (energySourceAt(r,c))
m_energy = FULL_ENERGY;
Quote:
|
You also need to write the energySourceAt accessor
|
Here's my problem, it doesn't compile:
bool energySourceAt(int r, int c) const
// If there is an energy source at coordinates (r,c), return true;
// otherwise, return false.
{
if (EnergySource(r,c))
return true;
else
return false;
}
Quote:
|
The Valley class has an array of energy sources - you need to look through that array to see if there is one at the current coordinates.
|
if (m_sources[MAXSOURCES] =EnergySource(m_row, m_col))
EDIT: Ahh, this doesn't work.
