-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathposition.hpp
55 lines (42 loc) · 1003 Bytes
/
position.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _CPROG_POSITION_HPP_
#define _CPROG_POSITION_HPP_
namespace cprogame{
class Position{
unsigned int x, y;
public:
/**
* Enumeration of the dimentions in this position.
* Namely, X and Y dimentions
*/
enum POS_DIM{
X_POS = 0,
Y_POS = 1
};
/**
* Default constructor, initialized to (0,0)
*/
Position();
/**
* Constructor that initilize position to the specified parameters
*/
Position(const unsigned &, const unsigned &);
/**
* Resets position to the specified values
*/
void set_pos(const unsigned &, const unsigned &);
/**
* Returns the manhattan distance between two positions.
*/
unsigned int operator-(const Position &);
/**
* Returns a modifier to the specified position parameter.
*/
unsigned int & operator()(const POS_DIM &);
/**
* Accessor to the specified position parameter.
*/
const unsigned int & operator()(const POS_DIM &) const;
bool operator==(const Position &);
}; // class position
} // namespace cprogame
#endif