Hey guys I need some help on this code.
I'll just post the parts of the code needed to do thing I'm stuck on.
class Robot
{
public:
// Constructor
Robot(Arena* ap, int r, int c);
// Accessors
int row() const;
int col() const;
// Mutators
void move();
private:
Arena* m_arena;
int m_row;
int m_col;
};
class Arena
{
public:
// Constructor/destructor
Arena(int nRows, int nCols);
~Arena();
// Accessors
int rows() const;
int cols() const;
Player* player() const;
int robotCount() const;
int nRobotsAt(int r, int c) const;
void display(string msg) const;
// Mutators
bool addRobot(int r, int c);
bool addPlayer(int r, int c);
bool destroyRobot(int r, int c);
bool moveRobots();
private:
int m_rows;
int m_cols;
Player* m_player;
Robot* m_robots[MAXROBOTS];
int m_nRobots;
};
This is what I have to do:
Indicate each robot's position, if one robot is at some grid point, set the char to 'R', if there are two to eight, set it to '2' through '8', set it to 9 if its 9 or more.
This is all I have so far..
for (int i = 0; i < m_nRobots; i++)
{
int r = m_player[i].row();
int c = m_player[i].col();
grid[r][c] = 'R';
}
Can someone please help me figure this out? Thanks!