As self-driving cars are becoming more common, I hear more and more people talking about the benefits when most of the cars on the road are self-driving and programming can optimize traffic flow. This, in turn, makes me wonder about other things that could be programmed in. One thing that programmers of self-driving cars (or governments that regulate them) could implement is an algorithm that minimizes overall damage in the case of an accident. For example, if a self-driving car is about to have a head-on collision with a loaded school bus, the car might avoid the accident by driving off the road, killing its passengers.
A human driver might make the same decision, but I understand that to be the unusual case. My question is about passengers in self-driving cars who wouldn't, were they driving, make the decision to sacrifice themselves on the spur of the moment.
What halachic issues would face the person who either owns or hires (e.g. through Uber) a self-driving car programmed in this way? A few aspects of the question seem relevant (there are probably others):
From the story in Bava Metzia 62b of the two people in the desert with enough water for one, where we learn (per R' Akiva) that the owner of the water bottle has priority, we might conclude that the owner/hirer of a self-driving car has priority and can't give that up.
Perhaps the car or its programmer is an "agent" for the owner/hirer and perhaps must prioritize that life over others. (I am not well-versed in the halachot of agency. I understand that a machine can't be an agent, but maybe the one who programmed it can be.)
Because a Jew seems to be allowed to sacrifice himself to save others (citation needed, but consider the military, police, and fire-fighters), we might reason that using such a car is fine so long as the owner/hirer is aware of the programming and "opts in". (Rambam says in Yesodei HaTorah 5 that self-sacrifice isn't allowed, though (h/t DonielF), so maybe there are additional factors.)
Because the torah places such a high value on human life, we might reason that driving carries with it higher risk of death but we now have the ability to globally minimize it, so we would be required to use this programming if it's available. (That is, the torah would have always preferred this but only now can we implement it.)
This future isn't that far away. Have any halachic authorities begun to explore this issue? What do they say?