private int getDir(char c) {
        int d = 0;
        switch (c) {
            case 'L':
            case 'l':
                d = 2;
                break;
            case 'R':
            case 'r':
                d = 8;
                break;
            case 'F':
            case 'f':
                d = 1;
                break;
            case 'B':
            case 'b':
                d = 4;
                break;
            default:
                System.out.println(c + " does not represent a valid direction!");
                System.exit(-2);
        }
        return d;
    }