-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquares.cpp
More file actions
94 lines (93 loc) · 1.87 KB
/
Squares.cpp
File metadata and controls
94 lines (93 loc) · 1.87 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include<iostream>
#include<string>
#include<stdlib.h>
#define SMALL_SQUARE_DIMENSION 112
#define BOARD_DIMENSION 896
using namespace std;
class Squares
{
string piece_name_squares;
string square_name;
int X;
int Y;
public:
Squares(){}
Squares(int x,int y)
{
X=x;
Y=y;
}
bool is_equal_coordinates(int x,int y)
{
if(x==X && y==Y)
return true;
return false;
}
void set_square_name(string temp)
{
square_name=temp;
}
void set_square_values(int x,int y)
{
X=x;
Y=y;
}
int get_X()
{
return X;
}
int get_Y()
{
return Y;
}
bool is_clicked(int x,int y)
{
if((X<x) && (Y<y) && (x<(X+SMALL_SQUARE_DIMENSION)) && (y<(Y+SMALL_SQUARE_DIMENSION)))
return true;
else
return false;
}
friend ostream & operator << (ostream &,Squares &a)
{
cout<<'('<<a.square_name<<','<<a.piece_name_squares<<','<<a.X<<','<<a.Y<<')'<<'\t';
return cout;
}
void set_piece_name(string p_name)
{
piece_name_squares=p_name;
}
string return_piece_name()
{
return piece_name_squares;
}
string return_square_name()
{
return square_name;
}
void display()
{
cout<<'('<<square_name<<','<<piece_name_squares<<')'<<'\t';
}
void set_Null()
{
piece_name_squares="0";
square_name="";
}
void set_piece_Null()
{
piece_name_squares="";
}
bool operator ==(Squares &a)
{
if((piece_name_squares==a.piece_name_squares) && (square_name==a.square_name) && (X==a.X) && (Y==a.Y))
return true;
else
return false;
}
bool is_empty()
{
if(piece_name_squares=="0")
return true;
return false;
}
};