April 14, 20178 yr Checking if a position is diagonal from you current position boolean isDiagonal(Position position) { return Math.abs(position.getY() - position.getX()) == Math.abs(myPosition().getY() - myPosition().getX()); } Checking if two supplied positions are diagonal from each other boolean isDiagonal(Position one, Position two) { return Math.abs(one.getY() - one.getX()) == Math.abs(two.getY() - two.getX()); } This will return true if the positions are diagonal from each other(ignoring the plane)
Create an account or sign in to comment