-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.hpp
57 lines (42 loc) · 1004 Bytes
/
common.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
56
57
#ifndef __COMMON_H__
#define __COMMON_H__
enum Side {
WHITE, BLACK
};
class Move {
public:
int x, y;
Move(int x, int y) {
this->x = x;
this->y = y;
}
~Move() {}
int getX() { return x; }
int getY() { return y; }
void setX(int x) { this->x = x; }
void setY(int y) { this->y = y; }
bool border()
{
int x = this->x;
int y = this->y;
if (x == 0 || x == 7 || y == 0 || y == 7) return true;
return false;
}
bool corner()
{
int x = this->x;
int y = this->y;
if ((x == 0 || x == 7) && (y == 0 || y == 7)) return true;
return false;
}
bool near_corner()
{
int x = this->x;
int y = this->y;
if ((x == 1 || x == 6) && (y == 0 || y == 7)) return true;
else if ((x == 1 || x == 6) && (y == 1 || y == 6)) return true;
else if ((x == 0 || x == 7) && (y == 1 || y == 6)) return true;
return false;
}
};
#endif