one thing he forgot while coding spoiler
a robot may learn "free will" and AI will learn a lot how to react.
however as a robot has nearly no morality or ethics or parents to make proud I think as a coder you need to enforce Asimovs 3 laws on robotics :
1.A robot may not injure a human being or, through inaction, allow a human being to come to harm.
2.A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
3.A robot must protect its own existence as long as such protection does not
conflict with the First or Second Laws