public static int getNewIndex(int currentIndex, Maze.Direction dir)
        {
            switch (dir)
            {
                case NORTH:
                    return (currentIndex - cols < 0) ? -1 : currentIndex - cols;
                case SOUTH:
                    return (currentIndex + cols) < cols * rows ? currentIndex + cols : -1;
                case EAST:
                    return ((currentIndex + 1) % cols == 0) ? -1 : currentIndex + 1;
                case WEST:
                    return (currentIndex % cols == 0) ? -1 : currentIndex - 1;
            }
            return -1;
        }