View Single Post
Old Dec 1st, 2006, 3:13 PM   #50
aznballerlee
Hobbyist Programmer
 
Join Date: Nov 2006
Posts: 111
Rep Power: 2 aznballerlee is on a distinguished road
Yeah, that compiles so great!
Just wondering if ..

    Robot* otherRobotAt(Robot* rp) const
//      If there is at least one robot (other than the one rp points to)
//      at the same (r,c) coordinates as the one rp points to, return a
//      pointer to the one of those other robots with the least amount
//      of energy remaining (if there's a tie, any one of the tied robots
//      will do); otherwise, return NULL.
//
	{

	}

would follow the same idea as

bool Valley::energySourceAt(int r, int c) const
{
  for (int k = 0; k < m_nsources; k++)
  {
      if ((m_sources[k]->row()== r) 
       && (m_sources[k]->col()== c))
            return true;
  }
  return false;
}
where we have to check each robot now, at each row and column to see if they match. It true, return .. a this?
aznballerlee is offline   Reply With Quote