Python Programming for the Absolute Beginner, 3rd Edition

The Critter Caretaker program charges the user with the care of his or her own virtual pet. The user names the critter and is completely responsible for keeping it happy, which is no small task. The user must feed and play with the critter to keep it in a good mood. The user can listen to the critter to learn how the critter is feeling, which can range from happy to mad. Figures 8.1 through 8.3 show off the Critter program.

Figure 8.1: You get to name your very own critter.

Figure 8.2: If you fail to feed or entertain your critter, it will have a mood change for the worse.

Figure 8.3: But with the proper care, your critter will come back to its original, sunny mood.

Though you could create this program without software objects, I created the critter as an object. Ultimately, this makes the program easier to work with and modify. Plus, it allows for painless scaling. Once you've created one critter, it's no sweat to create and manage a dozen. Could a critter farm be far off? (Not if you check the chapter challenges.)

Категории