>ut you'll need some hard code to describe how to react to either
My understanding is that's largely how it's done. The ML part is mostly about recognizing objects. But the car doesn't "learn" how to drive. It's told how to drive depending on what's happening in its field of view.
Which is why there's probably misperceptions about the importance of miles on the road. It uncovers un-programmed situations but it's not like the car runs over someone and reinforcement learning leads to it not doing that next time.