How to create this 'obstacle' string?

I have also asked Udacity tech support for an answer.

Firstly, you have not used break; after each of your switch cases, and so the switch just won’t work which is probably your issue. I am curious though, why use a switch instead of an if else in this situation? switches are good for large variety of options as it can simplify the code a little, but for a single either-or option, if else generally looks a bit better.

break has an effect, that effect is not needed here
your compiler can tell you if you’re missing a case for your enum if you use a switch, you don’t get that with if-statements. the cosmetic difference is insignificant anyway

this gives a warning:

enum Vehicle { Car, Bike, Tricycle };

int wheels (Vehicle v) {
    switch (v) {
        case Car: return 4;
    }
}

but this does not, because everything is covered

enum Vehicle { Car, Bike, Tricycle };

int wheels (Vehicle v) {
    switch (v) {
        case Car: return 4;
        case Bike: return 2;
        case Tricycle: return 3;
    }
}

and this does not, even though things are missing

enum Vehicle { Car, Bike, Tricycle };

int wheels (Vehicle v) {
    if (v == Car) {
        return 4;
    }
    return 2;
}

And this gives a warning even though it does cover everything

enum Vehicle { Car, Bike, Tricycle };

int wheels(Vehicle v) {
  if (v == Car)
    return 4;
  if (v == Bike)
    return 2;
  if (v == Tricycle)
    return 3;
}