summaryrefslogtreecommitdiff
path: root/src/Q9/MovingRobot.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Q9/MovingRobot.java')
-rw-r--r--src/Q9/MovingRobot.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/Q9/MovingRobot.java b/src/Q9/MovingRobot.java
index 21c46a1..8c20ec8 100644
--- a/src/Q9/MovingRobot.java
+++ b/src/Q9/MovingRobot.java
@@ -54,32 +54,24 @@ public class MovingRobot extends Robot {
}
}
- /**
- * @return a random direction.
- */
+ /** @return a random direction. */
public int generateNextMove() {
return this.rng.nextInt(7) + 1;
}
- /**
- * @return true if the two robots are in the same coordinate.
- */
+ /** @return true if the two robots are in the same coordinate. */
public static boolean sameSlot(Robot r1, Robot r2) {
return r1.getX() == r2.getX() && r1.getY() == r2.getY();
}
- /**
- * @return The list of moves made by the robot.
- */
+ /** @return The list of moves made by the robot. */
public String printMoves() {
ArrayList<String> printableMoves = new ArrayList<String>();
for (Integer move : this.moves) printableMoves.add(String.valueOf(move));
return String.join(",", printableMoves);
}
- /**
- * Moves the robot in a random direction.
- */
+ /** Moves the robot in a random direction. */
public void move() {
int direction = generateNextMove();
while (!validateNextMove(direction)) direction = generateNextMove();
@@ -87,8 +79,8 @@ public class MovingRobot extends Robot {
}
/**
- * An overload of the move method that attempts to move in the direction
- * specified.
+ * An overload of the move method that attempts to move in the direction specified.
+ *
* @param direction the direction to move the robot towards.
*/
public void move(int direction) {
@@ -163,6 +155,7 @@ public class MovingRobot extends Robot {
/**
* The entry point to the console application.
+ *
* @param args the argument vector provided to the program.
*/
public static void main(String[] args) {