Building Classes

All objects in the simulated world correspond to programming objects in steve. In order to define an agent in the simulated world, you'll start by constructing a programming object, or class. This class will serve as a template which defines the agent's behaviors. This section describes how to construct and use these classes.

The section Defining Classes ([link]) describes how to define an empty class.

All classes have two major components: methods, which define a class's behavior and variables which define the data that the class can hold. These data can be used both to store information about the state of an agent, or information required for computation. The section Defining Instance Variables ([link]) details how variables can be added to objects, while the section Defining Class Methods ([link]) shows how methods are defined.

Two special methods are critical for an agent's behavior: one that gets called automatically when an agent is created, init, and another that is run automatically at every step of a simulation, iterate. These methods, and a few other special methods, are discussed in the section Special Method Names ([link])

Even after the class is defined, it will still not be present in the simulation. This is because a class is nothing more than a "template" for an agent. In order to bring agents into the simulation, you must use the template to create instances of the class. The section on Creating and Destroying Instances ([link]) describes how instances of classes are created and destroyed.