From 81e51d1a04d6fbcbc4365a78975d383e35d04ac5 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 11 Aug 2019 17:58:50 -0600 Subject: add documentation --- src/Q9/MovingRobot.java | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/Q9/MovingRobot.java') 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 printableMoves = new ArrayList(); 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) { -- cgit v1.2.3