But already programmers have intentionally written code to react when facing this dilemma. We just don't know what code they put in there.
Example: a truck stops in front of the autodriving car, too quickly for it to stop in time. It knows this; it understands its vehicle handling to many decimal places.
So what should it do? Continue futilely braking to a likely-fatal accident when it impacts the truck? Or swerve to avoid?
Swerving may involves other people now: people standing by the side of the road, or emergency vehicles and personnel at work. Even the people in cars behind, auto-driving or not they are part of this. We hit the truck; they hit us. Or we swerve; they hit the truck.
You see? Kill my passenger, or potentially more by saving my passenger.
It's not simple, and not obvious (thus the longevity of the philosophical puzzle). But now robots are making the decision.
We can make laws to force the programmers' hands. Then it's no longer the intentionality of the programmer we have to examine. It's the rules and regulations we put in place, the intentionality of the regulator, of the standards committee. Ultimately of voters.
My humble opinion is, autodriving cars should never leave the roadway. See, the people on the road have voluntarily put themselves 'in the game'. Kids playing by the side of the road are not part of this; they should under no circumstances ever be involved if possible.
Anyway, the trolley car problem. It sucks. It's here.