Project: Simulate with Objects

Build a basic simulation using object state and logic.

We'll cover the following

Let’s build a simple simulation using objects that remember their state and do things, like a digital pet or a game character.

Goal

You’ll aim to:

  • Use objects with fields and methods.

  • Track changing state (like hunger or health).

  • Update and print info over time.

Your task

Add a happiness variable to your pet. The variable value increases when the pet is playing and decreases when the pet is hungry.

Get hands-on with 1400+ tech skills courses.