-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessing.cpp
66 lines (65 loc) · 1.81 KB
/
processing.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
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
#include "processing.h"
#include <Arduino.h>
#include <Serial.h>
#include "robot.h"
#include "map.h"
// for processing, of form x y sideone sidetwo sidethree sidefour facing backtracking (no spaces) with 0 = open, 1 = wall, 2 = dead end, 3 = gone through for the sides
void processing(Robot& aRobot) {
String processing = String(aRobot.x()) + String(aRobot.y());
if(aRobot.World.getWall(aRobot.x(), aRobot.y(), NORTH)) {
processing += "1";
}
else if(aRobot.World.getDeadEnd(aRobot.x(), aRobot.y(), NORTH)) {
processing += "2";
}
else if(aRobot.World.getGoneThrough(aRobot.x(), aRobot.y(), NORTH)) {
processing += "3";
}
else {
processing += "0";
}
if(aRobot.World.getWall(aRobot.x(), aRobot.y(), EAST)) {
processing += "1";
}
else if(aRobot.World.getDeadEnd(aRobot.x(), aRobot.y(), EAST)) {
processing += "2";
}
else if(aRobot.World.getGoneThrough(aRobot.x(), aRobot.y(), EAST)) {
processing += "3";
}
else {
processing += "0";
}
if(aRobot.World.getWall(aRobot.x(), aRobot.y(), SOUTH)) {
processing += "1";
}
else if(aRobot.World.getDeadEnd(aRobot.x(), aRobot.y(), SOUTH)) {
processing += "2";
}
else if(aRobot.World.getGoneThrough(aRobot.x(), aRobot.y(), SOUTH)) {
processing += "3";
}
else {
processing += "0";
}
if(aRobot.World.getWall(aRobot.x(), aRobot.y(), WEST)) {
processing += "1";
}
else if(aRobot.World.getDeadEnd(aRobot.x(), aRobot.y(), WEST)) {
processing += "2";
}
else if(aRobot.World.getGoneThrough(aRobot.x(), aRobot.y(), WEST)) {
processing += "3";
}
else {
processing += "0";
}
processing += String(enumToInt(aRobot.frontOf()));
if(aRobot.backtracking == true) {
processing += "1";
}
else {
processing += "0";
}
Serial.println(processing);
}