// Interface for the Position class // CSE143 HW6 #ifndef _POSITION_H #define _POSITION_H enum Direction { North, East, South, West }; const int NumDirections = 4; // Returns true iff the direction is valid (one of the enum values) bool validDir(Direction dir); // Returns the opposite direction, i.e. North for South, East for West, etc. Direction oppositeDir(Direction dir); // Returns the next direction clockwise (e.g. nextDir(North) = East). Direction nextDir(Direction dir); // Position: models a pair of screen coordinates (x,y). class Position { public: // Initialize the position at (0,0) Position(); // Initialize the position to (x,y) Position(int x, int y); // Initialize the position to same as the other position Position(const Position& other); // Set the position to be the same as the other position Position& operator =(const Position& other); // = x coordinate of this position int getX() const; // = y coordinate of this position int getY() const; // Move the position units in direction , where North // is up the screen (bigger y's) and East is right on the screen (bigger // x's). void move(Direction dir, int distance); // Rotate this position around , according to : rotate 90, 180, // or 270 degrees clockwise, for = East, South or West, respectively. // If = North, ignore. Returns the new position. void rotate(Position axis, Direction dir); private: int x, y; // Coordinates; }; #endif // end of file