-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCell.cpp
More file actions
59 lines (44 loc) · 967 Bytes
/
Copy pathCell.cpp
File metadata and controls
59 lines (44 loc) · 967 Bytes
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
#pragma once
class cell{
int x,y;
bool iswall = 0;
bool in_path=0;
public:
cell() :x(0) , y(0) { };
cell(int x,int y,bool b=0): x(x) , y(y) , iswall(b){};
int get_x() const{
return x;
}
int get_Y() const{
return y;
}
bool issolid(){
return iswall;
}
void set_in_path(){
in_path=1;
}
void unset_inpath(){
in_path =0;
}
bool get_in_path(){
return in_path;
}
bool operator==(cell c){
if(x==c.get_x()&&y==c.get_Y()) {
return true;
}
return false;
}
void display(){
(iswall)? std::cout<<"#":std::cout<<"=";
std::cout<<std::endl;
std::cout<<"x:"<<get_x()<<"y:"<<get_Y()<<std::endl;
}
void toggle_wall(){
( iswall )? iswall=0:iswall=1;
}
}r(1,0),l(-1,0),n(0,1),s(0,-1); // directions
bool issolid(cell& c){
return c.issolid();
}