Note that despite you have to have the panel for the graphics, the implementation of the graphical part is optional. You can get extra credits for doing this, but I would recommend to do this when your game engine is complete. The text box debugging output is required, though.
The completed project should include two parts:
Additional requirements:
grig->Item[robot->position]->remove(robot);
Cell(2, 3) + NorthWest = Cell(1, 2)Hint: first implement the following class Direction that uses enumeration EDirection:
__value enum EDirection : unsigned short int {
East = 0,
NorthEast = 45,
North = 90,
NorthWest = 135,
West = 180,
SouthWest = 225,
South = 270,
SouthEast = 315
};
__value class Direction {
private:
int dir; // angle in degrees counterclockwise from the X-axsis
public:
Direction() : dir(0) {};
Direction(int d)
{
if( d < 0 )
d += (1-d/360)*360;
dir = d % 360;
};
Direction(EDirection d) : dir(d) {};
static double Cos(Direction d) { return Math::Cos( d.dir*Math::PI/180 ); };
static double Sin(Direction d) { return Math::Sin( d.dir*Math::PI/180 ); };
// some operators
static Direction op_Addition(Direction a, Direction b) { return Direction(a.dir+b.dir); };
static Direction op_Subtraction(Direction a, Direction b) { return Direction(a.dir-b.dir); };
static bool op_LessThanOrEqual(Direction a, Direction b) { return a.dir <= b.dir; };
static bool op_LessThan(Direction a, Direction b) { return a.dir < b.dir; };
static bool op_GreaterThanOrEqual(Direction a, Direction b) { return a.dir >= b.dir; };
static bool op_GreaterThan(Direction a, Direction b) { return a.dir > b.dir; };
static bool op_Equality(Direction a, Direction b) { return a.dir == b.dir; };
static bool op_Inequality(Direction a, Direction b) { return a.dir != b.dir; };
};
and overload operator op_Addition that takes the first argument of the class Cell
and the second argument of the class Direction. The same new class Direction
can be used in the Location class.