-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocation.h
68 lines (59 loc) · 893 Bytes
/
Location.h
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
58
59
60
61
62
63
64
65
66
67
#pragma once
/*
struct for representing locations in the grid.
*/
class Location
{
public:
int row, col;
Location()
{
row = col = 0;
};
Location(const Location & original)
{
col = original.col;
row = original.row;
};
Location(int r, int c)
{
row = r;
col = c;
};
void operator = (const Location & original)
{
col = original.col;
row = original.row;
}
bool operator == (Location & rhs) const
{
if ((col == rhs.col) && (row == rhs.row))
{
return true;
}
return false;
};
bool operator != (Location & rhs)
{
if ((col == rhs.col) && (row == rhs.row))
{
return false;
}
return true;
};
bool operator < (const Location & rhs) const
{
if (row < rhs.row)
{
return true;
}
else if ((row == rhs.row) && (col < rhs.col))
{
return true;
}
else
{
return false;
}
};
};