Methods Used by Capture the Flag Agents

This page gives a reference list of all of the methods available to Capture the Flag players. These methods are used to sense the environment and to execute actions.

Agent Sensor Methods

Agent sensor methods are methods that may be used by agents to sense their environment.
  • get-id-number

    returns an int, a unique number between 0 and 9 for each agent on the team. You can use this to assign different tasks to different agents (for example: offense, flag guard and jail guard).

  • sense-my-team

    returns a list of the players on the agent's team in the agent's sensor range.

  • sense-other-team

    returns a list of the players on the other team in the agent's sensor range.

  • sense-my-flag

    returns an object—the flag of the agent's team, if it is in the sensor range.

  • sense-other-flag

    returns an object—the flag of the other team, if it is in the sensor range.

  • sense-my-jail

    returns an object, the jail where your teammates are being held, if it is in the sensor range. This is the jail you want to get to in order to free your teammates.

  • sense-other-jail

    returns an object, the jail where the other team's players are being held, if it is in the sensor range. This is the jail you want to defend.

  • get-my-home-location

    returns a vector, the closest point to the agent on the agent's home-side.

  • get-angle to vectorLocation

    returns a number representing, in radians, the angle to the location vectorLocation. A positive number indicates that the point is to right of the agent, a negative number indicates that the point

Agent Action Methods

Agent action methods are method that an agent can execute to change its behavior. For Capture the Flag agents, this means turning or moving.
  • turn-left

    Turns the agent left by a small amount

  • turn-right

    Turns the agent right by a small amount

  • set-speed to agentSpeed

    Sets the speed of the agent to agentSpeed units. agentSpeed may be between 0.0 and 1.0.

Controller Methods

Controller methods are methods which all agents can access by referring to the variable controller, which is defined for all agents.
  • get-time

    returns a float, the current time in simulated seconds. Since the game is only 500.0 seconds long, you may wish to modify agent behaviors based on the current time.

  • get-jailed-red-count

    returns an int, the number of Red agents in jail.

  • get-jailed-blue-count

    returns an int, the number of Blue agents in jail.

"Real" Object Information Method

This method can be called for any "Real" object, including both agents and flags:
  • get-location

    returns a vector, the location of a given object.