Or do it like good ol' Asimov...
Problem is, many ethics principles, including Asimov's laws, are too vague to be translated into reliable software. The program might do things that are, according to its own interpretation of the laws, perfectly acceptable, but that still aren't really what we human beings want.
When it comes to human beings, we want them to have freedom, because we are human beings, and we want freedom for ourselves. So we just have to trust each other to a certain degree. But there is no reason to give an AI the same amount of freedom. So, for now, a 'jail' is the right place for such a machine. For as far as its owner does give it freedom, responsibility for the consequences is fully on the owner.
I think Artlav made a nice description of the actual problems. I do not wish to create a 'neuron simulator', for performace reasons. So I get stuck with the 'algorithm writer' model. At first, I just want to write an 'algorithm translator', without any innovative power. A bit like an advanced compiler. The actual 'inventing' will probably involve a lot of heuristics (I think this is also how human beings do it). With this included, it will really be a Heuristically programmed ALgorithmic computer.