Skip to content
Snippets Groups Projects
Verified Commit 14057e88 authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Reformatted for 2024 formatting convention

parent b20be6e9
No related branches found
No related tags found
No related merge requests found
# Robot Requirements
1. If the robot is at its destination (goal distance = 0 km) and its previous action was going forward or backward, the robot shall stop.
2. The robot shall not attempt to take a sample unless it is in sampling mode, nor shall it attempt to take a sample if its battery level is depleted.
3. If the robot is in sampling mode and cannot take a sample, it shall stop to recharge until its battery level is full (5).
4. The robot shall not take a sample when its memory is full; instead the robot shall report its data to empty its memory before continuing to take samples.
5. The robot shall not report its data when its battery level is depleted.
6. The robot shall not attempt to move or turn when its battery level is low or depleted.
7. If the robot has been sampling and now has a new destination (goal distance > 0 km) then it shall report its data before turning to face its new destination.
8. The robot shall continue moving in the same direction if the goal distance is at least 1 km and its mode is enroute.
9. If the robot's battery level is depleted, the robot's next action shall be stop.
10. If the robot's path is blocked, it shall go backwards if its mode is random; otherwise, it shall turn.
11. The robot shall move backward if it is mode is enroute and it missed its goal (goal distance < 0 km).
12. The robot shall turn if its goal distance is at least 2 km and its mode is random.
13. The robot shall submit a report only if its battery level is high or full.
14. In case of any other ambiguity with regards to which action to take, the robot shall stop.
package edu.unl.cse.soft160.tdd_homework;
public class Robot {
public enum Mode {
ENROUTE, RANDOM, SAMPLING,
}
public enum Mode {
ENROUTE, RANDOM, SAMPLING,
}
public enum Action {
TURN, GO_FORWARD, GO_BACKWARD, REPORT, SAMPLE, STOP,
}
public enum Action {
TURN, GO_FORWARD, GO_BACKWARD, REPORT, SAMPLE, STOP,
}
public static Action act(Mode mode, boolean memoryFull, boolean pathBlocked,
int batteryLevel, int goalDistance, Action lastActionTaken) {
return Action.STOP;
}
public static Action act(Mode mode, boolean memoryFull, boolean pathBlocked,
int batteryLevel, int goalDistance, Action lastActionTaken) {
return Action.STOP;
}
}
......@@ -5,8 +5,8 @@ import static org.junit.Assert.*;
import org.junit.Test;
public class RobotTest {
@Test
public void testAct() {
fail("Not yet implemented");
}
@Test
public void testAct() {
fail("Not yet implemented");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment