A Very Quick Overview of Writing Agent Behaviors in breve

Before jumping into Capture the Flag, here's take a quick overview of how a typical agent behaves in a breve simulation. In breve, agent behaviors are run repeatedly over a series of timesteps. At each timestep, the agents typically perform the following steps:

  1. Get data about the environment from sensors
  2. Process sensor data
  3. Preform an action based on the data

Defining a simple agent behavior in breve is simply a matter of performing these steps via a function called iterate. As an example of this concept, we'll write a player with a simple behavior divided into these three steps:

CaptureTheFlagPlayer : myBluePlayer {
    + to iterate:
        if ( self get-angle to ( self get-other-home-location ) ) < 0:
            self turn-left.

        super iterate.
}
The specific steps in the example above are:
  1. The agent senses the angle to the other team's home territory
  2. The agent processes this value by comparing it to 0
  3. The agent performs an action (turns left) if the angle is less than 0.
As a final note, the line super iterate. is required by the breve engine to execute agent behaviors correctly. It should be included at the bottom of every agent strategy.