-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcell.cpp
More file actions
75 lines (62 loc) · 1.16 KB
/
Copy pathcell.cpp
File metadata and controls
75 lines (62 loc) · 1.16 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
#include "cell.h"
#include <QDebug>
Cell::Cell()
{
clear();
}
void Cell::clear()
{
visited = false;
for(uint8_t i = 0; i < 4 ; i++)
{
walls = 0;
}
clearData();
}
bool Cell::isVisited()
{
return visited;
}
void Cell::checkVisited()
{
visited = true;
}
uint8_t Cell::getX()
{
return x;
}
uint8_t Cell::getY()
{
return y;
}
bool Cell::getWall(TypeWall typewall)
{
return (typewall & walls) == typewall ? true : false; //AND bit : if 0110 && 0010 = 0010 then true
}
void Cell::setWall(TypeWall maskTypewall)
{
walls = walls | maskTypewall; //OR bit : = 0110 || 0001 = 0111
}
void Cell::delWall(TypeWall maskTypewall)
{
walls -= maskTypewall; //ADN !bit : = 0110 && !(0010) = 0110 && 1101 = 0100
}
QList<uint8_t> Cell::getData()
{
return data;
}
void Cell::setData(QList<uint8_t> data)
{
this->data = data;
}
void Cell::clearData()
{
data.clear();
}
void Cell::checkTheLock()
{
for(uint8_t i = 0; i < 4 ; i++)
{
walls = 15;
}
}