This question already has an answer here:
As we approach the age of artificial intelligence, I was curious about whole brain emulation. If a brain and consciousnesses is uploaded to a computer, is it still the same person, even if it was programmed to be the same person. I.e. if a personality is uploaded to a computer and trained to think it is the same brain, is it?