-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sensor.cpp
37 lines (28 loc) · 646 Bytes
/
Sensor.cpp
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
#include "Sensor.h"
#include "Map.h"
#include <vector>
using namespace std;
Sensor::Sensor(Map *mp) {
map = mp;
}
Sensor::~Sensor() {
}
std::vector<std::pair<int, int>> Sensor::getDustCoords() {
dustCoords.clear();
for (int i = 0; i < map->getMapSize(); i++)
for (int j = 0; j < map->getMapSize(); j++)
{
if (map->getCell(i, j)->hasDust())
dustCoords.emplace_back(i, j);
}
return dustCoords;
}
bool Sensor::isJewel(int x, int y) {
return map->getCell(x, y)->hasJewel();
}
bool Sensor::isDust(int x, int y) {
return map->getCell(x, y)->hasDust();
}
pair<int, int> Sensor::locateAgent() {
return map->getVacuum();
}