A Tamagotchi is a kind of digital pet. I think the most popular digital pet these days is Nintendogs, though I could be wrong. Basically, they are all the same: if you pet the creature and give it treats, it acts happy and thrives. If you neglect it or punish it too much, it acts dejected.
The digital creature is not really experiencing pleasure and pain when it is treated in these ways. We can be sure of this because the code for experiencing pleasure and the code for experiencing pain are almost identical. And these procedures are so simple that they show up in every kind of program and device, not just those for simulating puppies.A reasonable person would agree that a Tamagotchi does not feel real pain while a puppy does.
The question that no scientist can answer is, how does real pain and pleasure happen in the puppy? The simulation of the puppy is much simpler than a real puppy, it's true. But the things that are missing-- comprehension of ideas, more senses, greater motor control, anticipation of the future and memory of the past, and so forth, don't seem necessary for the raw sensation of pain or pleasure. Even profoundly brain-damaged individuals without any of these abilities can still experience pleasure and pain.
In the future, these simulations will become more realistic in appearance and have more of these mental abilities. But the key ability-- the ability to actually have subjective experiences-- is still missing. Whatever it is the brain is doing is something different than what the computer is doing. In the puppy,
Patting causes pleasure which causes behavior.
In the Tamagotchi,
Patting causes behavior.
Scientists are aware of this "explanatory gap," but to date no one has any way to explain what it is that the brain is doing to create subjective experiences.