From d2495a55aad12e1cad51b0497bf2eac74c5ab9c0 Mon Sep 17 00:00:00 2001 From: Thomas Kwashnak Date: Thu, 6 Jan 2022 16:12:04 -0500 Subject: [PATCH] Added Comments --- 30_Cube/java/src/Cube.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/30_Cube/java/src/Cube.java b/30_Cube/java/src/Cube.java index 1237a49d..0100682a 100644 --- a/30_Cube/java/src/Cube.java +++ b/30_Cube/java/src/Cube.java @@ -178,6 +178,12 @@ public class Cube { } } + /** + * Checks if a move is valid + * @param from The point that the player is at + * @param to The point that the player wishes to move to + * @return True if the player is only moving, at most, 1 location in any direction, False if the move is invalid + */ private boolean isMoveValid(Location from, Location to) { return Math.abs(from.x - to.x) + Math.abs(from.y - to.y) + Math.abs(from.z - to.z) <= 1; }