diff --git a/cicaprojekt/Direction.java b/cicaprojekt/Direction.java index e5a0a3e..5b0e96f 100644 --- a/cicaprojekt/Direction.java +++ b/cicaprojekt/Direction.java @@ -2,4 +2,19 @@ package cicaprojekt; public enum Direction { NORTH, SOUTH, EAST, WEST; + + public static Direction invert(Direction direction) { + switch (direction) { + case NORTH: + return SOUTH; + case EAST: + return WEST; + case SOUTH: + return NORTH; + case WEST: + return EAST; + default: + return NORTH; + } + } }