-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobot.cpp
More file actions
executable file
·27 lines (25 loc) · 789 Bytes
/
Copy pathRobot.cpp
File metadata and controls
executable file
·27 lines (25 loc) · 789 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
#include "Robot.h"
RobotOperation RightAffineRobot::makeDecision(RobotSensorValue front, RobotSensorValue left, RobotSensorValue right){
if (right == ROBOT_EMPTY_PATH){
return ROBOT_TURN_RIGHT_MAKE_STEP;
}
if (front == ROBOT_EMPTY_PATH){
return ROBOT_MAKE_STEP;
}
if (left == ROBOT_EMPTY_PATH){
return ROBOT_TURN_LEFT_MAKE_STEP;
}
return ROBOT_TURN_RIGHT;
}
int LeftAffineRobot::makeDecision(RobotSensorValue front, RobotSensorValue left, RobotSensorValue right){
if (left == ROBOT_EMPTY_PATH){
return ROBOT_TURN_LEFT_MAKE_STEP;
}
if (front == ROBOT_EMPTY_PATH){
return ROBOT_MAKE_STEP;
}
if (right == ROBOT_EMPTY_PATH){
return ROBOT_TURN_RIGHT_MAKE_STEP;
}
return ROBOT_TURN_LEFT;
}