diff options
| author | mo khan <mo@mokhan.ca> | 2019-08-11 17:58:50 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2019-08-11 17:58:50 -0600 |
| commit | 81e51d1a04d6fbcbc4365a78975d383e35d04ac5 (patch) | |
| tree | 0673324025cfd821233c8900eea1390e8d150c07 /src/Q9/MovingRobot.java | |
| parent | 03d8081a7382705a81ed2c80e2bc1e4f807b5dc6 (diff) | |
add documentation
Diffstat (limited to 'src/Q9/MovingRobot.java')
| -rw-r--r-- | src/Q9/MovingRobot.java | 21 |
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) { |
