Before deciding what a robot should do in that circumstance, maybe we should agree on what a human should do. This is a tricky philosophical question that has not found any sort of consensus today.
A consensus will never be found. People can't even agree on which way a toilet paper roll should be placed on the dispenser. I have little hope in this resolving.
What should I do? Depends on how fast I'm going and the statistical chance that the impact will have more casualties than if I veered off a cliff.
What would I do? Swerve into traffic.
What should the Computer do? Calculate the statistical probabilities of fatalities in both situations and chose the one with the highest survival rate.
What will it do? Blue Screen.
Edit: I would just like to add some perspective so people can see this from a logical point of view.
You are not your Cars friend. To the Car you are just another Human, just like the Humans in the other Cars. A problem I can see People having is that there should be some sentimental weight that the Car places on your life but sadly that destroys the entire system.
Put yourself in the shoes of the Cars in the opposing lanes (A). What would you want the Car (B) to do? Drive off a cliff or crash into you? Well, If the Car (A) your piloting is also autonomous it may choose the option of Car (B) going off the cliff as this saves your life. Now if both Cars put value on your (The driver of said vehicles) life, the whole thing reverts back to simple logic of choosing the option with the least probable casualties.
This question really should be a two-part question. Question 2 should be, "If a Car has a critical failure and as such has an option to either swerve into your trajectory to potentially save that passengers life on the Risk of killing you and another or driving off a Cliff killing that passenger with probable certainty; what option should that Car choose?"
If I were the programmer, I'd choose the option with the highest probability of survival, it's the logical, reasonable and just choice.