Scientists investigate a tricky moral dilemma that machines will have to grapple with when cars drive themselves.