When you get a good score while playing the built-in games, your Tamagotchi's happiness hearts go up. If you get a perfect score, they all fill up at once.
Also, if you can find your Tamagotchi character's favorite food, and serve it to them, their happiness hearts will all fill up. spudilike's V3 Character Chart (includes wake/sleep times, base weight, food like/hate, ...)