Okay, the code works now! I'll do the rest of the step function now.
EDIT:
I continued, tried, played around, and got stuck once again.
// The attempt to move consumes one unit of energy.
// If as a result of the attempt to move, the robot is at an energy
// source, it's recharged to the FULL_ENERGY level.
m_energy--;
if (m_sources[m_nsources] = new EnergySource(r,c))
m_energy = FULL_ENERGY;
// If at this spot there's another robot whose energy level is 0,
// then if we have at least SHARE_THRESHHOLD units of energy,
// transfer SHARE_AMOUNT units to that other robot. (If there
// are two or more dead robots here, we donate to only one.)
// Return true, indicating the robot attempted to move.
else if (// another robot's energy is 0)
if (m_energy > SHARE_THRESHHOLD)
// that robot's energy = SHARE_AMOUNT
return true; }
I don't know what to stick in the parts I // out.