package org.academiadecodigo.carcrash.field;

/**
 * MIT License
 * (c) 2017 Ricardo Constantino
 */

public enum Direction {
    NORTH,
//    NORTHEAST,
    EAST,
//    SOUTHEAST,
    SOUTH,
//    SOUTHWEST,
    WEST;
//    NORTHWEST;

    public boolean isOpposite(Direction other) {
        return other == getOpposite();
    }

    public Direction getOpposite() {
        switch (this) {
            case NORTH:
                return SOUTH;
//            case NORTHEAST:
//                return other == SOUTHWEST;
            case EAST:
                return WEST;
//            case SOUTHEAST:
//                return other == NORTHWEST;
            case SOUTH:
                return NORTH;
//            case SOUTHWEST:
//                return other == NORTHEAST;
            case WEST:
                return EAST;
//            case NORTHWEST:
//                return other == SOUTHEAST;
            default:
                return null;
        }
    }
}
